text stringlengths 0 2.2M |
|---|
ConstructTestArgNoAlloc<14> VNA14(14);
|
ConstructTestArgAlloc<1> VA1(1); // leave default allocator, on purpose
|
ConstructTestArgAlloc<2> VA2(2);
|
ConstructTestArgAlloc<3> VA3(3);
|
ConstructTestArgAlloc<4> VA4(4);
|
ConstructTestArgAlloc<5> VA5(5);
|
ConstructTestArgAlloc<6> VA6(6);
|
ConstructTestArgAlloc<7> VA7(7);
|
ConstructTestArgAlloc<8> VA8(8);
|
ConstructTestArgAlloc<9> VA9(9);
|
ConstructTestArgAlloc<10> VA10(10);
|
ConstructTestArgAlloc<11> VA11(11);
|
ConstructTestArgAlloc<12> VA12(12);
|
ConstructTestArgAlloc<13> VA13(13);
|
ConstructTestArgAlloc<14> VA14(14);
|
// ====================
|
// Base Type Qualifiers
|
// ====================
|
// The following empty classes are used as qualifiers for the base type,
|
// allowing to modify behavior of the 'bslma::ConstructionUtil::construct'
|
// functions via different trait values for different base class
|
// specifications.
|
class TRIVIAL {}; // trivially copyable type
|
class NON_TRIVIAL {}; // non-trivially copyable type
|
class BSLMA_ALLOC {}; // type using bslma allocator
|
class ARG_T_ALLOC {}; // tape using special argument with allocator
|
// ==================
|
// class BaseTestType
|
// ==================
|
template <class T>
|
class BaseTestType {
|
// This class provides a mechanism (static variables) to establish exactly
|
// which copy or move constructor is called.
|
public:
|
// PUBLIC CLASS DATA
|
static int s_copyConstructorInvocations;
|
static int s_moveConstructorInvocations;
|
static int s_copyAllocConstructorInvocations;
|
static int s_moveAllocConstructorInvocations;
|
static int s_copyArgTConstructorInvocations;
|
static int s_moveArgTConstructorInvocations;
|
// DATA
|
my_ClassDef d_def; // object's value
|
// CREATORS
|
explicit BaseTestType(bslma::Allocator *alloc = 0)
|
// Create an object having the null value and optionally specified
|
// 'alloc'.
|
{
|
d_def.d_value = 0;
|
d_def.d_allocator_p = alloc;
|
}
|
BaseTestType(int value, bslma::Allocator *alloc = 0) // IMPLICIT
|
// Create an object that has the specified 'value' and that uses the
|
// optionally specified 'alloc' to supply memory.
|
{
|
d_def.d_value = value;
|
d_def.d_allocator_p = alloc;
|
}
|
BaseTestType(const BaseTestType& original)
|
// Create an object having the value of the specified 'original'
|
// object.
|
{
|
++s_copyConstructorInvocations;
|
d_def.d_value = original.d_def.d_value;
|
d_def.d_allocator_p = 0;
|
}
|
BaseTestType(const BaseTestType& original, bslma::Allocator *alloc)
|
// Create an object that has the value of the specified 'original'
|
// object and that uses the specified 'alloc' to supply memory.
|
{
|
++s_copyAllocConstructorInvocations;
|
d_def.d_value = original.d_def.d_value;
|
d_def.d_allocator_p = alloc;
|
}
|
BaseTestType(bsl::allocator_arg_t ,
|
bslma::Allocator *alloc,
|
const BaseTestType& original)
|
// Following the 'allocator_arg_t' construction protocol create an
|
// object having the same value as the specified 'original' object that
|
// uses the specified 'alloc' to supply memory.
|
{
|
++s_copyArgTConstructorInvocations;
|
d_def.d_value = original.d_def.d_value;
|
d_def.d_allocator_p = alloc;
|
}
|
BaseTestType(bslmf::MovableRef<BaseTestType> original) // IMPLICIT
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.