Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/boost/serialization/utility.hpp @ 13

Last change on this file since 13 was 12, checked in by landauf, 17 years ago

added boost

File size: 1.7 KB
Line 
1#ifndef  BOOST_SERIALIZATION_UTILITY_HPP
2#define BOOST_SERIALIZATION_UTILITY_HPP
3
4// MS compatible compilers support #pragma once
5#if defined(_MSC_VER) && (_MSC_VER >= 1020)
6# pragma once
7#endif
8
9/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10// serialization/utility.hpp:
11// serialization for stl utility templates
12
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)
17
18//  See http://www.boost.org for updates, documentation, and revision history.
19
20#include <utility>
21#include <boost/config.hpp>
22
23#include <boost/type_traits/remove_const.hpp>
24#include <boost/serialization/nvp.hpp>
25
26// function specializations must be defined in the appropriate
27// namespace - boost::serialization
28#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
29#define STD _STLP_STD
30#else
31#define STD std
32#endif
33
34namespace boost { 
35namespace serialization {
36
37// pair
38template<class Archive, class F, class S>
39inline void serialize(
40    Archive & ar,
41    STD::pair<F, S> & p,
42    const unsigned int /* file_version */
43){
44    // note: we remove any const-ness on the first argument.  The reason is that
45    // for stl maps, the type saved is pair<const key, T).  We remove
46    // the const-ness in order to be able to load it.
47    typedef BOOST_DEDUCED_TYPENAME boost::remove_const<F>::type typef;
48    ar & boost::serialization::make_nvp("first", const_cast<typef &>(p.first));
49    ar & boost::serialization::make_nvp("second", p.second);
50}
51
52} // serialization
53} // namespace boost
54#undef STD
55
56#endif // BOOST_SERIALIZATION_UTILITY_HPP
Note: See TracBrowser for help on using the repository browser.