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

Detailed Description

Outline

Purpose

Provide an enumeration of move-state, including unsupported.

Classes

See also
bsltf_copystate

Description

This component provides a struct, bsltf_MoveState, which serves as a namespace for enumerating the move-state of an object, including an unknown value indicating that the test type does not support tracking of this information. An object is involved in a move operation if that object was either the source or target of a move construction or move assignment. It's up to the test type to support moved-into or moved-from or both using separate instances of this enum.

Enumerators

Name Description
----------- -------------------------------------------------------------
e_NOT_MOVED The type was not involved in a move operation.
e_MOVED The type was involved in a move operation.
e_UNKNOWN The type does not expose move-state infromation.

When converted to bool, e_NOT_MOVED yields false whereas the rest yield true. When e_UNKNOWN is not expected, this conversion makes it easy to check a value for the binary copied/not-copied attribute.

Usage

This section illustrates intended use of this component.

Example 1: Basic Syntax

The following snippets of code provide a simple illustration of using bsltf::MoveState.

First, we create a variable value of type bsltf::MoveState::Enum and initialize it with the enumerator value bsltf::MoveState::e_MOVED:

Enum
Enumeration of move state.
Definition bsltf_movestate.h:119
@ e_MOVED
Definition bsltf_movestate.h:122

Now, we store the address of its ASCII representation in a pointer variable, asciiValue, of type const char *:

const char *asciiValue = bsltf::MoveState::toAscii(value);
static const char * toAscii(MoveState::Enum value)

Finally, we verify the value of asciiValue:

assert(0 == strcmp(asciiValue, "MOVED"));