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