Home | Libraries | People | FAQ | More |
boost::get — Retrieves a value of a specified type from a given
variant
.
// In header: <boost/variant/get.hpp> template<typename U, typename T1, typename T2, ..., typename TN> U * get(variant<T1, T2, ..., TN> * operand); template<typename U, typename T1, typename T2, ..., typename TN> const U * get(const variant<T1, T2, ..., TN> * operand); template<typename U, typename T1, typename T2, ..., typename TN> U & get(variant<T1, T2, ..., TN> & operand); template<typename U, typename T1, typename T2, ..., typename TN> const U & get(const variant<T1, T2, ..., TN> & operand); template<typename U, typename T1, typename T2, ..., typename TN> U && get(variant<T1, T2, ..., TN> && operand);
Evaluates to strict_get
if BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT
is not defined. If BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT
is defined then evaluates to relaxed_get
.
Recomendation: Use
get
in new code without defining
BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT
. In that way get
provides more compile time checks and its behavior is closer to std::get
from C++ Standard Library.