text
stringlengths
0
2.2M
template <>
struct is_trivially_copyable< ArgTAllocTestType > : false_type {};
} // close namespace bsl
namespace BloombergLP {
namespace bslma {
template <>
struct UsesBslmaAllocator<BslmaAllocTestType> : bsl::true_type {};
template <>
struct UsesBslmaAllocator<ArgTAllocTestType> : bsl::true_type {};
} // close package namespace
namespace bslmf {
template <>
struct UsesAllocatorArgT<ArgTAllocTestType> : bsl::true_type {};
} // close namespace bslmf
} // close enterprise namespace
// ==========================
// class MoveOnlyBaseTestType
// ==========================
template <class T>
class MoveOnlyBaseTestType {
// This class, having deprecated copy constructors, provides a mechanism
// (static variables) to establish exactly which copy or move constructor
// is called.
private:
// NOT IMPLEMENTED
MoveOnlyBaseTestType(const MoveOnlyBaseTestType&); // = delete;
MoveOnlyBaseTestType(const MoveOnlyBaseTestType&, bslma::Allocator *);
// = delete;
MoveOnlyBaseTestType(bsl::allocator_arg_t ,
bslma::Allocator *,
const MoveOnlyBaseTestType&); // = delete;
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 MoveOnlyBaseTestType(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;
}
MoveOnlyBaseTestType(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;
}
MoveOnlyBaseTestType(bslmf::MovableRef<MoveOnlyBaseTestType> original)
// IMPLICIT
// Create an object having the same value as the specified 'original'
// object by moving the contents of 'original' to the newly-created
// object.
{
++s_moveConstructorInvocations;
MoveOnlyBaseTestType& lvalue = original;
d_def.d_value = lvalue.d_def.d_value;
d_def.d_allocator_p = 0;
}
MoveOnlyBaseTestType(bslmf::MovableRef<MoveOnlyBaseTestType> original,
bslma::Allocator *alloc)
// Create an object having the same value as the specified 'original'
// object that uses the specified 'alloc' to supply memory by moving
// the contents of 'original' to the newly-created object.
{
++s_moveAllocConstructorInvocations;
MoveOnlyBaseTestType& lvalue = original;
d_def.d_value = lvalue.d_def.d_value;
d_def.d_allocator_p = alloc;
}
MoveOnlyBaseTestType(bsl::allocator_arg_t ,
bslma::Allocator *alloc,
bslmf::MovableRef<MoveOnlyBaseTestType> original)