30 #ifndef CEREAL_TYPES_BOOST_VARIANT_HPP_
31 #define CEREAL_TYPES_BOOST_VARIANT_HPP_
34 #if defined(_MSC_VER) && _MSC_VER < 1911
35 #define CEREAL_CONSTEXPR_LAMBDA
37 #define CEREAL_CONSTEXPR_LAMBDA constexpr
41 #include <boost/variant/variant_fwd.hpp>
42 #include <boost/variant/static_visitor.hpp>
46 namespace boost_variant_detail
49 template <
class Archive>
64 template <
class Archive,
class T>
98 template <
class Variant,
class Archive>
108 template <
class Archive,
class Variant>
113 variant = std::move(
value);
117 template<
class Variant,
class Archive>
123 variant = std::move(*loadWrapper.
construct.ptr());
127 template<
class Variant,
class Archive>
136 template <
class Archive,
typename ... VariantTypes>
inline
139 int32_t which = variant.which();
142 variant.apply_visitor(visitor);
146 template <
class Archive,
typename ... VariantTypes>
inline
152 using LoadFuncType = void(*)(Archive &, boost::variant<VariantTypes...> &);
155 if(which >=
int32_t(
sizeof(loadFuncArray)/
sizeof(loadFuncArray[0])))
156 throw Exception(
"Invalid 'which' selector when deserializing boost::variant");
158 loadFuncArray[which](ar, variant);
162 #undef CEREAL_CONSTEXPR_LAMBDA
#define CEREAL_CONSTEXPR_LAMBDA
Definition: boost_variant.hpp:37
Main cereal functionality.
Used to construct types with no default constructor.
Definition: access.hpp:165
bool itsValid
Definition: access.hpp:218
#define CEREAL_NVP_(name, value)
Convenience for creating a templated NVP.
Definition: helpers.hpp:201
#define CEREAL_ALIGNOF
Checks if C++14 is available.
Definition: macros.hpp:153
type
The type the bitset is encoded with.
Definition: bitset.hpp:44
in certain simple scenarios. They should probably not be used if maximizing performance is the main o...
Definition: access.hpp:42
std::enable_if< std::is_arithmetic< T >::value, void >::type CEREAL_LOAD_FUNCTION_NAME(BinaryInputArchive &ar, T &t)
Loading for POD types from binary.
Definition: binary.hpp:126
std::enable_if< std::is_arithmetic< T >::value, void >::type CEREAL_SAVE_FUNCTION_NAME(BinaryOutputArchive &ar, T const &t)
Saving for POD types to binary.
Definition: binary.hpp:118
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1282
signed int int32_t
Definition: stdint.h:123
An exception class thrown when things go wrong at runtime.
Definition: helpers.hpp:49
Definition: boost_variant.hpp:66
typename std::aligned_storage< sizeof(T), CEREAL_ALIGNOF(T)>::type ST
Definition: boost_variant.hpp:67
::cereal::construct< T > construct
Definition: boost_variant.hpp:87
void CEREAL_SERIALIZE_FUNCTION_NAME(Archive &ar)
Definition: boost_variant.hpp:81
ST st
Definition: boost_variant.hpp:86
~LoadAndConstructLoadWrapper()
Definition: boost_variant.hpp:73
LoadAndConstructLoadWrapper()
Definition: boost_variant.hpp:69
static void load_variant(Archive &, Variant &)
Definition: boost_variant.hpp:99
Definition: boost_variant.hpp:106
static void load_variant_impl(Archive &ar, Variant &variant, std::true_type)
Definition: boost_variant.hpp:109
static void load_variant_impl(Archive &ar, Variant &variant, std::false_type)
Definition: boost_variant.hpp:118
static void load_variant(Archive &ar, Variant &variant)
Definition: boost_variant.hpp:128
Definition: boost_variant.hpp:51
variant_save_visitor(Archive &ar_)
Definition: boost_variant.hpp:52
Archive & ar
Definition: boost_variant.hpp:60
void operator()(T const &value) const
Definition: boost_variant.hpp:55
static T * load_andor_construct(A &, construct< T > &)
Definition: traits.hpp:1344