/*! * \file bitset.hpp * \brief Provides Boost.Serialization support for std::bitset * \author Brian Ravnsgaard Riis * \author Kenneth Riddile * \date 16.09.2004, updated 04.03.2009 * \copyright 2004 Brian Ravnsgaard Riis * \license Boost Software License 1.0 */ #ifndef BOOST_SERIALIZATION_BITSET_HPP #define BOOST_SERIALIZATION_BITSET_HPP // MS compatible compilers support #pragma once #if defined(_MSC_VER) # pragma once #endif #include #include // size_t #include #include #include #include namespace boost{ namespace serialization{ template inline void save( Archive & ar, std::bitset const & t, const unsigned int /* version */ ){ const std::string bits = t.template to_string< std::string::value_type, std::string::traits_type, std::string::allocator_type >(); ar << BOOST_SERIALIZATION_NVP( bits ); } template inline void load( Archive & ar, std::bitset & t, const unsigned int /* version */ ){ std::string bits; ar >> BOOST_SERIALIZATION_NVP( bits ); t = std::bitset(bits); } template inline void serialize( Archive & ar, std::bitset & t, const unsigned int version ){ boost::serialization::split_free( ar, t, version ); } // don't track bitsets since that would trigger tracking // all over the program - which probably would be a surprise. // also, tracking would be hard to implement since, we're // serialization a representation of the data rather than // the data itself. template struct tracking_level > : mpl::int_ {} ; } //serialization } //boost #endif // BOOST_SERIALIZATION_BITSET_HPP