Quick Links:

bal | bbl | bdl | bsl

Namespaces

Component bsltf_bitwisemoveabletesttype
[Package bsltf]

Provide a bitwise-moveable test class. More...

Namespaces

namespace  bsltf

Detailed Description

Outline
Purpose:
Provide a bitwise-moveable test class.
Classes:
bsltf::BitwiseMoveableTestType bitwise-moveable test class
See also:
Component bsltf_templatetestfacility
Description:
This component provides a single, unconstrained (value-semantic) attribute class, BitwiseMoveableTestType, that is bitwise-moveable and defines the bslmf::IsBitwiseMoveable type trait.
Attributes:
  Name                Type         Default
  ------------------  -----------  -------
  data                int          0
  • data: representation of the class value
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:
  template <class TYPE>
  void printTypeTraits()
      // Prints the traits of the parameterized 'TYPE' to the console.
  {
      if (bslma::UsesBslmaAllocator<TYPE>::value) {
          printf("Type defines bslma::UsesBslmaAllocator.\n");
      }
      else {
          printf(
               "Type does not define bslma::UsesBslmaAllocator.\n");
      }

      if (blsmf::IsBitwiseMoveable<TYPE>::value) {
          printf("Type defines bslmf::IsBitwiseMoveable.\n");
      }
      else {
          printf("Type does not define bslmf::IsBitwiseMoveable.\n");
      }
  }
Now, we invoke the printTypeTraits function template using BitwiseMoveableTestType as the parameterized TYPE:
  printTypeTraits<BitwiseMoveableTestType>();
Finally, we observe the console output:
  Type does not define bslma::UsesBslmaAllocator.
  Type defines bslmf::IsBitwiseMoveable.