]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/serialization/include/boost/serialization/bitset.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / serialization / include / boost / serialization / bitset.hpp
1 /*!
2 * \file bitset.hpp
3 * \brief Provides Boost.Serialization support for std::bitset
4 * \author Brian Ravnsgaard Riis
5 * \author Kenneth Riddile
6 * \date 16.09.2004, updated 04.03.2009
7 * \copyright 2004 Brian Ravnsgaard Riis
8 * \license Boost Software License 1.0
9 */
10 #ifndef BOOST_SERIALIZATION_BITSET_HPP
11 #define BOOST_SERIALIZATION_BITSET_HPP
12
13 // MS compatible compilers support #pragma once
14 #if defined(_MSC_VER)
15 # pragma once
16 #endif
17
18 #include <bitset>
19 #include <cstddef> // size_t
20
21 #include <boost/config.hpp>
22 #include <boost/serialization/split_free.hpp>
23 #include <boost/serialization/string.hpp>
24 #include <boost/serialization/nvp.hpp>
25
26 namespace boost{
27 namespace serialization{
28
29 template <class Archive, std::size_t size>
30 inline void save(
31 Archive & ar,
32 std::bitset<size> const & t,
33 const unsigned int /* version */
34 ){
35 const std::string bits = t.template to_string<
36 std::string::value_type,
37 std::string::traits_type,
38 std::string::allocator_type
39 >();
40 ar << BOOST_SERIALIZATION_NVP( bits );
41 }
42
43 template <class Archive, std::size_t size>
44 inline void load(
45 Archive & ar,
46 std::bitset<size> & t,
47 const unsigned int /* version */
48 ){
49 std::string bits;
50 ar >> BOOST_SERIALIZATION_NVP( bits );
51 t = std::bitset<size>(bits);
52 }
53
54 template <class Archive, std::size_t size>
55 inline void serialize(
56 Archive & ar,
57 std::bitset<size> & t,
58 const unsigned int version
59 ){
60 boost::serialization::split_free( ar, t, version );
61 }
62
63 // don't track bitsets since that would trigger tracking
64 // all over the program - which probably would be a surprise.
65 // also, tracking would be hard to implement since, we're
66 // serialization a representation of the data rather than
67 // the data itself.
68 template <std::size_t size>
69 struct tracking_level<std::bitset<size> >
70 : mpl::int_<track_never> {} ;
71
72 } //serialization
73 } //boost
74
75 #endif // BOOST_SERIALIZATION_BITSET_HPP