text
stringlengths 0
2.2M
|
---|
#if defined(BSLS_COMPILERFEATURES_SUPPORT_ENUM_CLASS)
|
enum class EnumClassType {
|
// This 'enum' type is used for testing.
|
};
|
#endif
|
class MyTriviallyCopyableType {
|
};
|
struct MyNonTriviallyCopyableType {
|
MyNonTriviallyCopyableType() {}
|
MyNonTriviallyCopyableType(const MyNonTriviallyCopyableType&) {}
|
// Explicitly supply constructors that do nothing, to ensure that this
|
// class has no trivial traits detected with a conforming C++11 library
|
// implementation.
|
};
|
typedef int MyTriviallyCopyableType::*DataMemberPtrTestType;
|
// This pointer to instance data member type is used for testing.
|
typedef int (MyTriviallyCopyableType::*MethodPtrTestType)();
|
// This pointer to non-static function member type is used for testing.
|
} // close unnamed namespace
|
namespace bsl {
|
template <>
|
struct is_trivially_copyable<MyTriviallyCopyableType> : bsl::true_type {
|
// This template specialization for 'is_trivially_copyable' indicates that
|
// 'MyTriviallyCopyableType' is a trivially copyable.
|
};
|
} // close namespace bsl
|
namespace {
|
struct UserDefinedTcTestType {
|
// This user-defined type, which is marked to be trivially copyable using
|
// template specialization (below), is used for testing.
|
int d_data;
|
// UserDefinedTcTestType() {}
|
// UserDefinedTcTestType(const UserDefinedTcTestType&) {}
|
// Explicitly supply constructors that do nothing, to ensure that this
|
// class has no trivial traits detected with a conforming C++11 library
|
// implementation.
|
};
|
struct UserDefinedTcTestType2 {
|
// This user-defined type, which is marked to be trivially copyable using
|
// the 'BSLMF_NESTED_TRAIT_DECLARATION' macro, is used for testing.
|
BSLMF_NESTED_TRAIT_DECLARATION(UserDefinedTcTestType2,
|
bsl::is_trivially_copyable);
|
int d_data;
|
// UserDefinedTcTestType2() {}
|
// UserDefinedTcTestType2(const UserDefinedTcTestType2&) {}
|
// Explicitly supply constructors that do nothing, to ensure that this
|
// class has no trivial traits detected with a conforming C++11 library
|
// implementation.
|
};
|
struct UserDefinedNonTcTestType {
|
// This user-defined type, which is not marked to be trivially copyable, is
|
// used for testing.
|
UserDefinedNonTcTestType() {}
|
UserDefinedNonTcTestType(const UserDefinedNonTcTestType&) {}
|
};
|
} // close unnamed namespace
|
namespace {
|
struct StructWithCtor {
|
// This user-defined type with constructors with side-effects is used to
|
// guarantee that the type is detected as NOT 'is_trivially_copyable' even
|
// by the native implementation.
|
StructWithCtor()
|
{
|
printf("default StructWithCtor\n");
|
}
|
StructWithCtor(const StructWithCtor&)
|
{
|
printf("copy StructWithCtor\n");
|
}
|
};
|
struct NamedStructWithNonPodMember {
|
// This user-defined type is used to check the expected behaviour for a
|
// 'well-behaved' non-copyable type.
|
StructWithCtor x;
|
};
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.