BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bsltf_bitwisecopyabletesttype

Detailed Description

Outline

Purpose

Provide a bitwise-copyable test class.

Classes

See also
bsltf_templatetestfacility

Description

This component provides a single, unconstrained (value-semantic) attribute class, BitwiseCopyableTestType, that is bitwise-copyable and defines the bslmf::IsBitwiseCopyable type trait.

Attributes

Name Type Default
------------------ ----------- -------
data int 0

Usage

This section illustrates intended use of this component.

Example 1: Printing the Supported Traits

Suppose we wanted to print the supported traits of this test type.

First, we create a function template printTypeTraits with a parameterized TYPE:

/// Prints the traits of the parameterized 'TYPE' to the console.
template <class TYPE>
void printTypeTraits()
{
printf("Type defines bslma::UsesBslmaAllocator.\n");
}
else {
printf(
"Type does not define bslma::UsesBslmaAllocator.\n");
}
if (bls::is_trivially_copyable<TYPE>::value) {
printf("Type defines bsl::is_trivially_copyable.\n");
}
else {
printf("Type does not define bsl::is_trivially_copyable.\n");
}
}
Definition bslma_usesbslmaallocator.h:343

Now, we invoke the printTypeTraits function template using BitwiseCopyableTestType as the parameterized TYPE:

printTypeTraits<BitwiseCopyableTestType>();

Finally, we observe the console output:

Type does not define bslma::UsesBslmaAllocator.
Definition bslmf_istriviallycopyable.h:329