[#BloombergLP-bsltf-ArgumentTypeByValue]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bsltf.adoc[bsltf]::ArgumentTypeByValue
:relfileprefix: ../../
:mrdocs:

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

== Synopsis

Declared in `&lt;bsltf&lowbar;argumenttype&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;int N&gt;
class ArgumentTypeByValue
    : public xref:BloombergLP/bsltf/ArgumentType.adoc[ArgumentType&lt;N&gt;]
----

== Base Classes

[cols="1,4"]
|===
| Name| Description
| `xref:BloombergLP/bsltf/ArgumentType.adoc[ArgumentType&lt;N&gt;]`
| 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&period; Its main purpose is for following an argument through a forwarding interface in test drivers&period; 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&hyphen;class methods and constructors or in calls to methods and constructors of a class template under test&period; When an object of this type is copied or moved (via construction or assignment), the value returned by the `copyMoveState` accessor (the _copy&sol;move_ _state_), is updated for the target object and, in the case of a move, for the source object as well&period;
|===

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bsltf/ArgumentTypeByValue/2constructor-07.adoc[`ArgumentTypeByValue`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bsltf/ArgumentType/operator_assign-09.adoc[`operator&equals;`] 
| Assignment operators
| xref:BloombergLP/bsltf/ArgumentType/copyMoveState.adoc[`copyMoveState`] 
| Return the copy&sol;move state of this object&period;
| xref:BloombergLP/bsltf/ArgumentType/movedFrom.adoc[`movedFrom`] 
| Return `MoveState&colon;&colon;e&lowbar;MOVED` if this object was the source of a move construction or move&hyphen;assignment operation, `MoveState&colon;&colon;e&lowbar;NOT&lowbar;MOVED` if it was not the source of a move operation, and `MoveState&colon;&colon;e&lowbar;UNKNOWN` if its copy&sol;move state is not known&period; Note that converting the result to `bool` will yield `true` if this object was moved from and `false` otherwise&period; Note also that the value returned by this accessor may change if this object is subsequently the target of an assignment&period;
| xref:BloombergLP/bsltf/ArgumentType/movedInto.adoc[`movedInto`] 
| Return `MoveState&colon;&colon;e&lowbar;MOVED` if this object was the target of a move construction or move&hyphen;assignment operation, `MoveState&colon;&colon;e&lowbar;NOT&lowbar;MOVED` if it was not the target of a move operation, and `MoveState&colon;&colon;e&lowbar;UNKNOWN` if its copy&sol;move state is not known&period; Note that converting the result to `bool` will yield `true` if this object was moved into and `false` otherwise&period; 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&period;
| xref:BloombergLP/bsltf/ArgumentType/reset.adoc[`reset`] 
| Set this object to the default&hyphen;constructed state&period;
| xref:BloombergLP/bsltf/ArgumentType/set.adoc[`set`] 
| Set this object to the specified `value` having the specified copy&sol;move `state`&period; The behavior is undefined if the arguments would violate any class invariants, i&period;e&period;, an invalid copy&sol;move state, a value less than &hyphen;1, or a moved&hyphen;from state with value other than &hyphen;1&period;
| xref:BloombergLP/bsltf/ArgumentType/2conversion.adoc[`operator int`] 
| Return the value of this object&period;
|===


== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bsltf/copyMoveState-05.adoc[`copyMoveState`]
| Return the copy&sol;move state of the specified `obj`&period; This function is an ADL customization point used by `CopyMoveState&colon;&colon;get(obj)`&period;
| xref:BloombergLP/bsltf/debugprint-01f.adoc[`debugprint`]
| Print the specified `value` as a string&period; This is an ADL customization point&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
