Get a pointer to the value stored in an OFvariant holding the selected alternative.
More...
|
template<typename Alternative , typename... Alternatives> |
Alternative * | OFget (OFvariant< Alternatives... > *v) |
| Try to get a pointer to the given alternative from an OFvariant object. More...
|
|
template<typename Alternative , typename... Alternatives> |
const Alternative * | OFget (const OFvariant< Alternatives... > *v) |
| Try to get a pointer to the given alternative from an OFvariant object. More...
|
|
Get a pointer to the value stored in an OFvariant holding the selected alternative.
- See also
- OFvisit – Apply a visitor to an OFvariant object.
◆ OFget() [1/2]
template<typename Alternative , typename... Alternatives>
Alternative * OFget |
( |
OFvariant< Alternatives... > * |
v | ) |
|
|
related |
Try to get a pointer to the given alternative from an OFvariant object.
- Template Parameters
-
Alternative | the chosen alternative that shall be accessed. |
Alternatives | the alternatives the given variant could hold, will be deduced automatically. |
- Parameters
-
v | a reference to an OFvariant object potentially holding Alternative . |
- Returns
- the address of the contained value of type
Alternative
if such a value is contained. OFnullptr
otherwise.
Usage Example:
if( int* pI = OFget<int>( v ) )
{
COUT << "Yes, it really is an int with the value " << *pI << '!' << OFendl;
*pI = "27";
}
◆ OFget() [2/2]
template<typename Alternative , typename... Alternatives>
const Alternative * OFget |
( |
const OFvariant< Alternatives... > * |
v | ) |
|
|
related |
Try to get a pointer to the given alternative from an OFvariant object.
- Template Parameters
-
Alternative | the chosen alternative that shall be accessed. |
Alternatives | the alternatives the given variant could hold, will be deduced automatically. |
- Parameters
-
v | a const reference to an OFvariant object potentially holding Alternative . |
- Returns
- the address of the contained value of type
const Alternative
if such a value is contained. OFnullptr
otherwise.
Usage Example:
if( int* pI = OFget<int>( v ) )
if( const int* pI = OFget<int>( v ) )
{
COUT << "Yes, it really is an int with the value " << *pI << '!' << OFendl;
*pI = "27";
}