30 #ifndef CEREAL_TYPES_BITSET_HPP_
31 #define CEREAL_TYPES_BITSET_HPP_
38 namespace bitset_detail
42 enum class type : uint8_t
51 template <
class Archive,
size_t N>
inline
56 auto const b = bits.to_ulong();
57 ar(
CEREAL_NVP_(
"type", bitset_detail::type::ulong) );
60 catch( std::overflow_error
const & )
64 auto const b = bits.to_ullong();
65 ar(
CEREAL_NVP_(
"type", bitset_detail::type::ullong) );
68 catch( std::overflow_error
const & )
70 ar(
CEREAL_NVP_(
"type", bitset_detail::type::string) );
77 template <
class Archive,
size_t N>
inline
80 bitset_detail::type t;
85 case bitset_detail::type::ulong:
89 bits = std::bitset<N>( b );
92 case bitset_detail::type::ullong:
96 bits = std::bitset<N>( b );
99 case bitset_detail::type::string:
103 bits = std::bitset<N>( b );
107 throw Exception(
"Invalid bitset data representation");
112 #endif // CEREAL_TYPES_BITSET_HPP_
#define CEREAL_NVP_(name, value)
Convenience for creating a templated NVP.
Definition: helpers.hpp:197
Definition: access.hpp:39
Main cereal functionality.
#define CEREAL_LOAD_FUNCTION_NAME
The deserialization (load) function name to search for.
Definition: macros.hpp:58
#define CEREAL_SAVE_FUNCTION_NAME
The serialization (save) function name to search for.
Definition: macros.hpp:65