Pass‐by‐value wrapper that avoids a C++03 conversion ambiguity.

Synopsis

Declared in <bsltf_argumenttype.h>

template<int N>
class ArgumentTypeByValue
    : public ArgumentType<N>

Description

This class works around a limitation in C++03 whereby initializing a pass‐by‐value parameter of type bslmf::ArgumentType<N> from a MovableRef<bslmf::ArgumentType<N> > results in an ambiguous conversion sequence (i.e., MovableRef::operator T& vs. ArgumentType(MovableRef) are equally good conversions). Pass‐by‐value use cases (e.g., recording the value category of multiple function arguments) can use this class as a parameter type, instead, eliminating the ambiguity because MovableRef<AT> ‐> AT& ‐> ArgumentTypeByValue requires two user‐defined conversions and is therefore eliminated during overload resolution.

Base Classes

Name

Description

ArgumentType<N>

Non‐allocating integer wrapper that tracks copy and move operations.

Member Functions

Name

Description

ArgumentTypeByValue [constructor]

Constructors

operator=

Assignment operators

copyMoveState

Return the copy/move state of this object.

movedFrom

Return whether this object was the source of a move operation.

movedInto

Return whether this object was the target of a move operation.

reset

Set this object to the default‐constructed state.

set

Set this object's value and copy/move state.

operator int

Return the value of this object.

Non-Member Functions

Name

Description

copyMoveState

Return the copy/move state of the specified obj.

debugprint

Print the specified object as a string.

Created with MrDocs