CppWAMP
C++11 client library for the WAMP protocol
|
Go to the documentation of this file.
7 #ifndef CPPWAMP_TYPES_OPTIONAL_HPP
8 #define CPPWAMP_TYPES_OPTIONAL_HPP
18 #include "../variant.hpp"
30 const auto& variant = conv.
variant();
34 opt = variant.
to<T>();
58 CPPWAMP_API
bool operator==(
const Variant& v,
const std::optional<T> o)
60 return !o ? !v : (v == *o);
65 CPPWAMP_API
bool operator==(
const std::optional<T> o,
const Variant& v)
72 CPPWAMP_API
bool operator!=(
const Variant& v,
const std::optional<T> o)
74 return !o ? !!v : (v != *o);
79 CPPWAMP_API
bool operator!=(
const std::optional<T> o,
const Variant& v)
86 #endif // CPPWAMP_TYPES_OPTIONAL_HPP
const Variant & variant() const
Returns a constant reference to the wrapped variant.
Definition: variant.hpp:1384
Discriminated union container that represents a JSON value.
Definition: variant.hpp:134
Variant & variant()
Returns a reference to the wrapped variant.
Definition: variant.hpp:1208
Definition: anyhandler.hpp:36
Wrapper around a destination Variant, used for conversions.
Definition: variant.hpp:604
Wrapper around a source Variant, used for conversions.
Definition: variant.hpp:650
void convert(TConverter &c, TValue &val)
General function for converting custom types to/from Variant.
Definition: variant.hpp:709
T to() const
Converts the variant's bound value to the given type.
Definition: variant.hpp:840
static Variant from(TValue &&value)
Constructs a variant from a custom type.
Definition: variant.hpp:744