BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bsltf::CopyMoveTracker Class Reference

#include <bsltf_copymovetracker.h>

Public Member Functions

 CopyMoveTracker ()
 Create object an object in the e_NOT_COPIED_OR_MOVE state.
 
 CopyMoveTracker (const CopyMoveTracker &original)
 Create object an object in the e_COPIED_CONST_INTO state.
 
 CopyMoveTracker (CopyMoveTracker &original)
 Create object an object in the e_COPIED_NONCONST_INTO state.
 
 CopyMoveTracker (bslmf::MovableRef< CopyMoveTracker > original)
 
template<class DERIVED >
 CopyMoveTracker (bslmf::MovableRef< DERIVED > original, typename bsl::enable_if< bsl::is_convertible< DERIVED *, CopyMoveTracker * >::value >::type *=0)
 
 ~CopyMoveTracker ()=default
 
CopyMoveTrackeroperator= (const CopyMoveTracker &rhs)
 
CopyMoveTrackeroperator= (CopyMoveTracker &rhs)
 
CopyMoveTrackeroperator= (bslmf::MovableRef< CopyMoveTracker > rhs)
 
template<class DERIVED >
bsl::enable_if< bsl::is_convertible< DERIVED *, CopyMoveTracker * >::value, CopyMoveTracker & >::type operator= (bslmf::MovableRef< DERIVED > rhs)
 
void resetCopyMoveState ()
 Set this object to the e_NOT_COPIED_OR_MOVE state.
 
void setCopyMoveState (CopyMoveState::Enum state)
 
void swapCopyMoveStates (CopyMoveTracker &b)
 
CopyMoveState::Enum copyMoveState () const
 Return this object's state.
 
bool hasUnknownCopyMoveState () const
 
bool isCopiedConstInto () const
 
bool isCopiedInto () const
 
bool isCopiedNonconstInto () const
 
bool isMovedInto () const
 
bool isMovedFrom () const
 
bool isOriginal () const
 

Friends

template<class OTHER >
BSLS_KEYWORD_CONSTEXPR bsl::enable_if< bsl::is_same< CopyMoveTracker, OTHER >::value, bool >::type operator== (const CopyMoveTracker &, const OTHER &)
 
template<class OTHER >
BSLS_KEYWORD_CONSTEXPR bsl::enable_if< bsl::is_same< CopyMoveTracker, OTHER >::value, bool >::type operator!= (const CopyMoveTracker &, const OTHER &)
 
CopyMoveState::Enum copyMoveState (const CopyMoveTracker &tracker)
 
void setCopyMoveState (CopyMoveTracker *tracker, CopyMoveState::Enum state)
 

Detailed Description

Type that tracks whether it has been copied into, moved into, or moved from.

See bsltf_copymovetracker

Constructor & Destructor Documentation

◆ CopyMoveTracker() [1/5]

bsltf::CopyMoveTracker::CopyMoveTracker ( )
inline

◆ CopyMoveTracker() [2/5]

bsltf::CopyMoveTracker::CopyMoveTracker ( const CopyMoveTracker original)
inline

◆ CopyMoveTracker() [3/5]

bsltf::CopyMoveTracker::CopyMoveTracker ( CopyMoveTracker original)
inline

◆ CopyMoveTracker() [4/5]

bsltf::CopyMoveTracker::CopyMoveTracker ( bslmf::MovableRef< CopyMoveTracker original)
inline

Create object an object in the e_MOVED_INTO state and set the state of original to the bitwise OR of its inititial state and e_MOVED_FROM.

◆ CopyMoveTracker() [5/5]

template<class DERIVED >
bsltf::CopyMoveTracker::CopyMoveTracker ( bslmf::MovableRef< DERIVED >  original,
typename bsl::enable_if< bsl::is_convertible< DERIVED *, CopyMoveTracker * >::value >::type *  = 0 
)

Create object an object in the e_MOVED_INTO state and set the state of original to the bitwise OR of its initial state and e_MOVED_FROM. This constructor will not participate in overload resolution unless a DERIVED is derived from CopyMoveTracker; in C++03, therefore, this constructor will simulate automatic derived-to-base conversion of rvalue references.

◆ ~CopyMoveTracker()

bsltf::CopyMoveTracker::~CopyMoveTracker ( )
default

Member Function Documentation

◆ copyMoveState()

CopyMoveState::Enum bsltf::CopyMoveTracker::copyMoveState ( ) const
inline

◆ hasUnknownCopyMoveState()

bool bsltf::CopyMoveTracker::hasUnknownCopyMoveState ( ) const
inline

Return true if this object's state includes the e_UNKNOWN bit. This attribute can be true only if setCopyMoveState was called with an enumerator value that includes the e_UNKNOWN bit.

◆ isCopiedConstInto()

bool bsltf::CopyMoveTracker::isCopiedConstInto ( ) const
inline

Return true if this object's state includes the e_COPIED_CONST_INTO bits but not e_UNKNOWN. This attribute is true if this object was copy constructed or copy assigned from a const lvalue (or, in C++03, from a prvalue).

◆ isCopiedInto()

bool bsltf::CopyMoveTracker::isCopiedInto ( ) const
inline

Return true if this object's state includes the e_COPIED_INTO bit but not e_UNKNOWN. This attribute is true if either isCopiedConstInto() or isCopiedNonconstInto() is true.

◆ isCopiedNonconstInto()

bool bsltf::CopyMoveTracker::isCopiedNonconstInto ( ) const
inline

Return true if this object's state includes the e_COPIED_NONCONST_INTO bits but not e_UNKNOWN. This attribute is true if this object was copy constructed or copy assigned from a non-const lvalue.

◆ isMovedFrom()

bool bsltf::CopyMoveTracker::isMovedFrom ( ) const
inline

Return true if this object's state includes the e_MOVED_FROM bit but not e_UNKNOWN. This attribute is true if this object was the argument of the move constructor or the rhs of the move assignment operator and was not subsequently modified.

◆ isMovedInto()

bool bsltf::CopyMoveTracker::isMovedInto ( ) const
inline

Return true if this object's state includes the e_MOVED_INTO bit but not e_UNKNOWN. This attribute is true if this object was move constructed or was the lhs the of move assignment operator.

◆ isOriginal()

bool bsltf::CopyMoveTracker::isOriginal ( ) const
inline

Return true if this object is not in a copied-into, moved-into, or unknown state. This attribute is true if this object was default constructed or reset and not subsequently assigned to.

◆ operator=() [1/4]

CopyMoveTracker & bsltf::CopyMoveTracker::operator= ( bslmf::MovableRef< CopyMoveTracker rhs)
inline

Set this object to the e_MOVED_INTO state and return a modifiable reference to this object. Set the state of rhs to the bitwise OR of its initial state and e_MOVED_FROM.

◆ operator=() [2/4]

template<class DERIVED >
bsl::enable_if< bsl::is_convertible< DERIVED *, CopyMoveTracker * >::value, CopyMoveTracker & >::type bsltf::CopyMoveTracker::operator= ( bslmf::MovableRef< DERIVED >  rhs)
inline

Set this object to the e_MOVED_INTO state and return a modifiable reference to this object. Set the state of rhs to the bitwise OR of its initial state and e_MOVED_FROM. This operator will not participate in overload resolution unless a DERIVED is derived from CopyMoveTracker; in C++03, therefore, this operator will simulate automatic derived-to-base conversion of rvalue references.

◆ operator=() [3/4]

CopyMoveTracker & bsltf::CopyMoveTracker::operator= ( const CopyMoveTracker rhs)
inline

Set this object to the e_COPIED_CONST_INTO state and return a modifiable reference to this object.

◆ operator=() [4/4]

CopyMoveTracker & bsltf::CopyMoveTracker::operator= ( CopyMoveTracker rhs)
inline

Set this object to the e_COPIED_NONCONST_INTO state and return a modifiable reference to this object.

◆ resetCopyMoveState()

void bsltf::CopyMoveTracker::resetCopyMoveState ( )
inline

◆ setCopyMoveState()

void bsltf::CopyMoveTracker::setCopyMoveState ( CopyMoveState::Enum  state)
inline

Set this object to the specified state, which might be the bitwise OR of e_MOVED_FROM and one of the other enumerator values. The behavior is undefined unless CopyMoveState::isValid(state) is true.

◆ swapCopyMoveStates()

void bsltf::CopyMoveTracker::swapCopyMoveStates ( CopyMoveTracker b)
inline

Set the state of both the specified this and b objects to the bitwise OR of e_MOVED_INTO and e_MOVED_FROM.

Friends And Related Symbol Documentation

◆ copyMoveState

CopyMoveState::Enum copyMoveState ( const CopyMoveTracker tracker)
friend

Return the state of the specified tracker. This function is an ADL customization point used by CopyMoveState::get(obj).

◆ operator!=

template<class OTHER >
BSLS_KEYWORD_CONSTEXPR bsl::enable_if< bsl::is_same< CopyMoveTracker, OTHER >::value, bool >::type operator!= ( const CopyMoveTracker ,
const OTHER &   
)
friend

Return false; the copy/move state is not a salient attribute, so all CopyMoveTracker objects compare equal. Note that this operator is called implicitly if a client class defines a defaulted comparison operator (C++20), but will not be selected by overload resolution for a derived class having no comparison operator.

◆ operator==

template<class OTHER >
BSLS_KEYWORD_CONSTEXPR bsl::enable_if< bsl::is_same< CopyMoveTracker, OTHER >::value, bool >::type operator== ( const CopyMoveTracker ,
const OTHER &   
)
friend

Return true; the copy/move state is not a salient attribute, so all CopyMoveTracker objects compare equal. Note that this operator is called implicitly if a client class defines a defaulted comparison operator (C++20), but will not be selected by overload resolution for a derived class having no comparison operator.

◆ setCopyMoveState

void setCopyMoveState ( CopyMoveTracker tracker,
CopyMoveState::Enum  state 
)
friend

Set the object at the specified tracker address to the specified state. This function is an ADL customization point used by CopyMoveState::set(obj, state). The behavior is undefined unless CopyMoveState::isValid(state) is true.


The documentation for this class was generated from the following file: