fix doc example typo
[boost.git] / boost / serialization / utility.hpp
blobf36b50f5ac9b00d57a2a4ca7173ee3742beced43
1 #ifndef BOOST_SERIALIZATION_UTILITY_HPP
2 #define BOOST_SERIALIZATION_UTILITY_HPP
4 // MS compatible compilers support #pragma once
5 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
6 # pragma once
7 #endif
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // serialization/utility.hpp:
11 // serialization for stl utility templates
13 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
14 // Use, modification and distribution is subject to the Boost Software
15 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
16 // http://www.boost.org/LICENSE_1_0.txt)
18 // See http://www.boost.org for updates, documentation, and revision history.
20 #include <utility>
21 #include <boost/config.hpp>
23 #include <boost/type_traits/remove_const.hpp>
24 #include <boost/serialization/nvp.hpp>
25 #include <boost/serialization/is_bitwise_serializable.hpp>
26 #include <boost/mpl/and.hpp>
28 namespace boost {
29 namespace serialization {
31 // pair
32 template<class Archive, class F, class S>
33 inline void serialize(
34 Archive & ar,
35 std::pair<F, S> & p,
36 const unsigned int /* file_version */
38 // note: we remove any const-ness on the first argument. The reason is that
39 // for stl maps, the type saved is pair<const key, T). We remove
40 // the const-ness in order to be able to load it.
41 typedef BOOST_DEDUCED_TYPENAME boost::remove_const<F>::type typef;
42 ar & boost::serialization::make_nvp("first", const_cast<typef &>(p.first));
43 ar & boost::serialization::make_nvp("second", p.second);
46 /// specialization of is_bitwise_serializable for pairs
47 template <class T, class U>
48 struct is_bitwise_serializable<std::pair<T,U> >
49 : public mpl::and_<is_bitwise_serializable<T>,is_bitwise_serializable<U> >
53 } // serialization
54 } // namespace boost
56 #endif // BOOST_SERIALIZATION_UTILITY_HPP