A holder for an instance of any scalar AMQP type. More...
#include <scalar.hpp>
Public Member Functions | |
scalar ()=default | |
Create an empty scalar. | |
template<class T > | |
scalar (const T &x) | |
Construct from any scalar type. | |
template<class T > | |
scalar & | operator= (const T &x) |
Assign from any scalar type. | |
void | clear () |
Clear the scalar, making it empty(). | |
Public Member Functions inherited from scalar_base | |
type_id | type () const |
AMQP type of data stored in the scalar. | |
bool | empty () const |
True if there is no value, i.e. type() == NULL_TYPE. | |
Related Symbols | |
(Note that these are not member symbols.) | |
template<class T > | |
T | get (const scalar &s) |
Get a contained value of type T. | |
template<class T > | |
T | coerce (const scalar &x) |
Coerce the contained value to type T. | |
template<class T > | |
T | coerce (scalar &x) |
Coerce the contained value to type T. | |
A holder for an instance of any scalar AMQP type.
|
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.
conversion_error | if contained value is not of type T. |
|
related |
Coerce the contained value to type T.
For example:
uint64_t i = coerce<uint64_t>(x)
This will succeed if x contains any numeric value, but may lose precision if it contains a float or double value.
conversion_error | if the value cannot be converted to T according to std::is_convertible |
|
related |
Coerce the contained value to type T.
For example:
uint64_t i = coerce<uint64_t>(x)
This will succeed if x contains any numeric value, but may lose precision if it contains a float or double value.
conversion_error | if the value cannot be converted to T according to std::is_convertible |