[#BloombergLP-bsltf-ArgumentType] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bsltf.adoc[bsltf]::ArgumentType :relfileprefix: ../../ :mrdocs: This class template wraps an integer value and provides implicit conversion to, and explicit conversion from, `int`, while keeping track of copy and move operations. Its main purpose is for following an argument through a forwarding interface in test drivers. Each value of the template parameter `N` yields a unique type, enabling a test driver to distingusih them when calling through a function template interface, thereby avoiding ambiguities or accidental switching of arguments in the implementation of test‐class methods and constructors or in calls to methods and constructors of a class template under test. When an object of this type is copied or moved (via construction or assignment), the value returned by the `copyMoveState` accessor (the _copy/move_ _state_), is updated for the target object and, in the case of a move, for the source object as well. == Synopsis Declared in `<bsltf_argumenttype.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<int N> class ArgumentType; ---- == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bsltf/ArgumentType/2constructor-08.adoc[`ArgumentType`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bsltf/ArgumentType/2destructor.adoc[`~ArgumentType`] [.small]#[destructor]# | Destroy this object. | xref:BloombergLP/bsltf/ArgumentType/operator_assign-09.adoc[`operator=`] | Assignment operators | xref:BloombergLP/bsltf/ArgumentType/copyMoveState.adoc[`copyMoveState`] | Return the copy/move state of this object. | xref:BloombergLP/bsltf/ArgumentType/movedFrom.adoc[`movedFrom`] | Return `MoveState::e_MOVED` if this object was the source of a move construction or move‐assignment operation, `MoveState::e_NOT_MOVED` if it was not the source of a move operation, and `MoveState::e_UNKNOWN` if its copy/move state is not known. Note that converting the result to `bool` will yield `true` if this object was moved from and `false` otherwise. Note also that the value returned by this accessor may change if this object is subsequently the target of an assignment. | xref:BloombergLP/bsltf/ArgumentType/movedInto.adoc[`movedInto`] | Return `MoveState::e_MOVED` if this object was the target of a move construction or move‐assignment operation, `MoveState::e_NOT_MOVED` if it was not the target of a move operation, and `MoveState::e_UNKNOWN` if its copy/move state is not known. Note that converting the result to `bool` will yield `true` if this object was moved into and `false` otherwise. Note that the value returned by this accessor may change if this object is subsequently the source of a move operation or the target of an assignment. | xref:BloombergLP/bsltf/ArgumentType/reset.adoc[`reset`] | Set this object to the default‐constructed state. | xref:BloombergLP/bsltf/ArgumentType/set.adoc[`set`] | Set this object to the specified `value` having the specified copy/move `state`. The behavior is undefined if the arguments would violate any class invariants, i.e., an invalid copy/move state, a value less than ‐1, or a moved‐from state with value other than ‐1. | xref:BloombergLP/bsltf/ArgumentType/2conversion.adoc[`operator int`] | Return the value of this object. |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:BloombergLP/bsltf/copyMoveState-05.adoc[BloombergLP::bsltf::copyMoveState]` | Return the copy/move state of the specified `obj`. This function is an ADL customization point used by `CopyMoveState::get(obj)`. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bsltf/debugprint-01f.adoc[`debugprint`] | Print the specified `value` as a string. This is an ADL customization point. |=== == Derived Classes [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bsltf/ArgumentTypeByValue.adoc[`ArgumentTypeByValue`] | 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. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#