text stringlengths 0 2.2M |
|---|
bslma::Allocator *const theAlloc = &testAllocator;
|
// 'defaultConstruct' invokes default constructor, with defaulted
|
// arguments, even if type does not take an allocator.
|
setToGarbage(&rawBuf);
|
Util::construct(rawBuf.as<my_Class1>(), theAlloc);
|
ASSERT(0 == rawBuf.d_allocator_p);
|
ASSERT(0 == rawBuf.d_value);
|
// 'copyConstruct' invokes copy constructor, even if type does not take
|
// an allocator.
|
setToGarbage(&rawBuf);
|
Util::construct(rawBuf.as<my_Class1>(), theAlloc, v1);
|
ASSERT(0 == rawBuf.d_allocator_p);
|
ASSERT(1 == rawBuf.d_value);
|
// 'copyConstruct' invokes copy constructor, passing the allocator if
|
// type takes an allocator.
|
setToGarbage(&rawBuf);
|
Util::construct(rawBuf.as<my_Class2>(), theAlloc, v2);
|
ASSERT(theAlloc == rawBuf.d_allocator_p);
|
ASSERT(2 == rawBuf.d_value);
|
// 'construct' invokes constructor, even if type does not take an
|
// allocator.
|
setToGarbage(&rawBuf);
|
Util::construct(rawBuf.as<my_Class1>(), theAlloc, 3);
|
ASSERT(0 == rawBuf.d_allocator_p);
|
ASSERT(3 == rawBuf.d_value);
|
// 'destroy' invokes destructor ... with no particular constraints.
|
setToGarbage(&rawBuf);
|
DestructionUtil::destroy(rawBuf.as<my_Class1>());
|
ASSERT(0 == rawBuf.d_allocator_p);
|
ASSERT(k_DESTROYED == rawBuf.d_value);
|
// 'construct' invokes constructor, passing the allocator if type takes
|
// an allocator.
|
setToGarbage(&rawBuf);
|
Util::construct(rawBuf.as<my_Class2>(), theAlloc, 4);
|
ASSERT(theAlloc == rawBuf.d_allocator_p);
|
ASSERT(4 == rawBuf.d_value);
|
// 'destroy' invokes destructor ... with no particular constraints.
|
setToGarbage(&rawBuf);
|
DestructionUtil::destroy(rawBuf.as<my_Class2>());
|
ASSERT(0 == rawBuf.d_allocator_p);
|
ASSERT(k_DESTROYED == rawBuf.d_value);
|
} break;
|
default: {
|
fprintf(stderr, "WARNING: CASE `%d' NOT FOUND.\n", test);
|
testStatus = -1;
|
}
|
}
|
if (testStatus > 0) {
|
fprintf(stderr, "Error, non-zero test status = %d.\n", testStatus);
|
}
|
return testStatus;
|
}
|
// ----------------------------------------------------------------------------
|
// Copyright 2013 Bloomberg Finance L.P.
|
//
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
// you may not use this file except in compliance with the License.
|
// You may obtain a copy of the License at
|
//
|
// http://www.apache.org/licenses/LICENSE-2.0
|
//
|
// Unless required by applicable law or agreed to in writing, software
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// See the License for the specific language governing permissions and
|
// limitations under the License.
|
// ----------------------------- END-OF-FILE ----------------------------------
|
#include <bsl_typeinfo.h>
|
#include <typeinfo>
|
#ifdef std
|
# error std was not expected to be a macro
|
#endif
|
namespace std { }
|
int main() { return 0; }
|
// ----------------------------------------------------------------------------
|
// Copyright 2013 Bloomberg Finance L.P.
|
//
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
// you may not use this file except in compliance with the License.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.