text
stringlengths
0
2.2M
// 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 by moving the contents
// of 'original' to the newly-created object.
{
++s_moveArgTConstructorInvocations;
MoveOnlyBaseTestType& lvalue = original;
d_def.d_value = lvalue.d_def.d_value;
d_def.d_allocator_p = alloc;
}
// ACCESSORS
int value() const
// Return the value of this object.
{
return d_def.d_value;
}
bslma::Allocator *allocator() const
// Return the allocator used by this object to supply memory.
{
return d_def.d_allocator_p;
}
};
// CLASS DATA
template <class T>
int MoveOnlyBaseTestType<T>::s_copyConstructorInvocations = 0;
template <class T>
int MoveOnlyBaseTestType<T>::s_moveConstructorInvocations = 0;
template <class T>
int MoveOnlyBaseTestType<T>::s_copyAllocConstructorInvocations = 0;
template <class T>
int MoveOnlyBaseTestType<T>::s_moveAllocConstructorInvocations = 0;
template <class T>
int MoveOnlyBaseTestType<T>::s_copyArgTConstructorInvocations = 0;
template <class T>
int MoveOnlyBaseTestType<T>::s_moveArgTConstructorInvocations = 0;
// =============================
// class MoveOnlyTrivialTestType
// =============================
typedef MoveOnlyBaseTestType<TRIVIAL> MoveOnlyTrivialTestType;
// ================================
// class MoveOnlyNonTrivialTestType
// ================================
typedef MoveOnlyBaseTestType<NON_TRIVIAL> MoveOnlyNonTrivialTestType;
// ================================
// class MoveOnlyBslmaAllocTestType
// ================================
typedef MoveOnlyBaseTestType<BSLMA_ALLOC> MoveOnlyBslmaAllocTestType;
// ===============================
// class MoveOnlyArgTAllocTestType
// ===============================
typedef MoveOnlyBaseTestType<ARG_T_ALLOC> MoveOnlyArgTAllocTestType;
// TRAITS
namespace bsl {
template <>
struct is_trivially_copyable<MoveOnlyTrivialTestType> : true_type {};
template <>
struct is_trivially_copyable<MoveOnlyNonTrivialTestType> : false_type {};
template <>
struct is_trivially_copyable<MoveOnlyBslmaAllocTestType> : false_type {};
template <>
struct is_trivially_copyable<MoveOnlyArgTAllocTestType> : false_type {};
} // close namespace bsl
namespace BloombergLP {
namespace bslma {
template <>
struct UsesBslmaAllocator<MoveOnlyBslmaAllocTestType> : bsl::true_type {};
template <>
struct UsesBslmaAllocator<MoveOnlyArgTAllocTestType> : bsl::true_type {};
} // close package namespace
namespace bslmf {
template <>
struct UsesAllocatorArgT<MoveOnlyArgTAllocTestType> : bsl::true_type {};
} // close namespace bslmf
} // close enterprise namespace