1 // ----------------------------------------------------------- 2 // 3 // Copyright (c) 2015 Seth Heeren 4 // 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) 8 // 9 // ----------------------------------------------------------- 10 11 #ifndef BOOST_DYNAMIC_BITSET_SERIALIZATION_HPP 12 #define BOOST_DYNAMIC_BITSET_SERIALIZATION_HPP 13 14 #include "boost/dynamic_bitset/dynamic_bitset.hpp" 15 #include <boost/serialization/vector.hpp> 16 17 namespace boost { 18 19 // implementation for optional zero-copy serialization support 20 template <typename Block, typename Allocator> 21 class dynamic_bitset<Block, Allocator>::serialize_impl 22 { 23 public: 24 template <typename Ar> serialize(Ar & ar,dynamic_bitset<Block,Allocator> & bs,unsigned)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); 28 } 29 }; 30 31 } 32 33 // ADL hook to Boost Serialization library 34 namespace boost { 35 namespace serialization { 36 37 template <typename Ar, typename Block, typename Allocator> serialize(Ar & ar,dynamic_bitset<Block,Allocator> & bs,unsigned version)38 void serialize(Ar& ar, dynamic_bitset<Block, Allocator>& bs, unsigned version) { 39 dynamic_bitset<Block, Allocator>::serialize_impl::serialize(ar, bs, version); 40 } 41 42 } // namespace serialization 43 } // namespace boost 44 45 #endif // include guard 46 47