1 // -----------------------------------------------------------
3 // Copyright (c) 2015 Seth Heeren
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // -----------------------------------------------------------
11 #ifndef BOOST_DYNAMIC_BITSET_SERIALIZATION_HPP
12 #define BOOST_DYNAMIC_BITSET_SERIALIZATION_HPP
14 #include "boost/dynamic_bitset/dynamic_bitset.hpp"
15 #include <boost/serialization/vector.hpp>
19 // implementation for optional zero-copy serialization support
20 template <typename Block, typename Allocator>
21 class dynamic_bitset<Block, Allocator>::serialize_impl
24 template <typename Ar>
25 static void serialize(Ar& ar, dynamic_bitset<Block, Allocator>& bs, unsigned) {
26 ar & serialization::make_nvp("m_num_bits", bs.m_num_bits)
27 & serialization::make_nvp("m_bits", bs.m_bits);
33 // ADL hook to Boost Serialization library
35 namespace serialization {
37 template <typename Ar, typename Block, typename Allocator>
38 void serialize(Ar& ar, dynamic_bitset<Block, Allocator>& bs, unsigned version) {
39 dynamic_bitset<Block, Allocator>::serialize_impl::serialize(ar, bs, version);
42 } // namespace serialization
45 #endif // include guard