value

A holder for any AMQP value, simple or complex. More...

`#include <value.hpp>`

Inherits value_base, and comparable< value >.

Inherited by value_ref.

## Public Member Functions

| value ()
| Create a null value.
template<class T >
| value (const T &x, typename assignable< T >::type *=0)
| Construct from any allowed type T.
template<class T >
assignable< T, value & >::type | operator= (const T &x)
| Assign from any allowed type T.
void | clear ()
| Reset the value to null.
Copy a value
| value (const value &)
value & | operator= (const value &)

## Friends

void | swap (value &, value &)
| swap values
std::ostream & | operator<< (std::ostream &, const value &)
Comparison operators
bool | operator== (const value &x, const value &y)
bool | operator< (const value &x, const value &y)

## Related Functions

(Note that these are not member functions.)
template<class T >
T | get (const value &v)
| Get a contained value of type T. More...
template<class T >
void | get (const value &v, T &x)
| Like get(const value&) but assigns the value to a reference instead of returning it. More...
template<class T >
T | coerce (const value &v)
| Coerce the contained value to type T. More...
template<class T >
void | coerce (const value &v, T &x)
| Like coerce(const value&) but assigns the value to a reference instead of returning it. More...

## Detailed Description

A holder for any AMQP value, simple or complex.

See also
  AMQP and C++ types

Examples:
  service_bus.cpp.

## Friends And Related Function Documentation

## coerce() [1/2]

T coerce | ( | const value & | v | ) |

related

Coerce the contained value to type T.

For example:

    uint64_t i = get<uint64_t>(x)

This will succeed if x contains any numeric value, but may lose precision if it contains a float or double value.

Exceptions

  conversion_error | if the value cannot be converted to T according to `std::is_convertible`

## coerce() [2/2]

void coerce | ( | const value & | v,
|  | T & | x
| ) |  |

related

Like coerce(const value&) but assigns the value to a reference instead of returning it.

May be more efficient for complex values (arrays, maps, etc.)

## get() [1/2]

T get | ( | const value & | v | ) |

related

Get a contained value of type T.

For example:

    uint64_t i = get<uint64_t>(x)

This will succeed if and only if x contains a uint64_t value.

Exceptions

  conversion_error | if contained value is not of type T.

Examples:
  service_bus.cpp.

## get() [2/2]

void get | ( | const value & | v,
|  | T & | x
| ) |  |

related

Like get(const value&) but assigns the value to a reference instead of returning it.

May be more efficient for complex values (arrays, maps, etc.)

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

- proton/value.hpp