Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

added boost

File size: 2.3 KB
Line 
1#ifndef BOOST_SERIALIZATION_LIST_HPP
2#define BOOST_SERIALIZATION_LIST_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// list.hpp: serialization for stl list templates
11
12// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
13// Use, modification and distribution is subject to the Boost Software
14// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15// http://www.boost.org/LICENSE_1_0.txt)
16
17//  See http://www.boost.org for updates, documentation, and revision history.
18
19#include <list>
20
21#include <boost/config.hpp>
22
23#include <boost/serialization/collections_save_imp.hpp>
24#include <boost/serialization/collections_load_imp.hpp>
25#include <boost/serialization/split_free.hpp>
26
27// function specializations must be defined in the appropriate
28// namespace - boost::serialization
29#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
30#define STD _STLP_STD
31#else
32#define STD std
33#endif
34
35namespace boost { 
36namespace serialization {
37
38template<class Archive, class U, class Allocator>
39inline void save(
40    Archive & ar,
41    const STD::list<U, Allocator> &t,
42    const unsigned int /* file_version */
43){
44    boost::serialization::stl::save_collection<
45        Archive, 
46        std::list<U, Allocator> 
47    >(ar, t);
48}
49
50template<class Archive, class U, class Allocator>
51inline void load(
52    Archive & ar,
53    STD::list<U, Allocator> &t,
54    const unsigned int /* file_version */
55){
56    boost::serialization::stl::load_collection<
57        Archive,
58        std::list<U, Allocator>,
59        boost::serialization::stl::archive_input_seq<
60            Archive, 
61            std::list<U, Allocator> 
62        >,
63        boost::serialization::stl::no_reserve_imp<STD::list<U, Allocator> >
64    >(ar, t);
65}
66
67// split non-intrusive serialization function member into separate
68// non intrusive save/load member functions
69template<class Archive, class U, class Allocator>
70inline void serialize(
71    Archive & ar,
72    STD::list<U, Allocator> & t,
73    const unsigned int file_version
74){
75    boost::serialization::split_free(ar, t, file_version);
76}
77
78} // serialization
79} // namespace boost
80
81#include <boost/serialization/collection_traits.hpp>
82
83BOOST_SERIALIZATION_COLLECTION_TRAITS(STD::list)
84#undef STD
85
86#endif // BOOST_SERIALIZATION_LIST_HPP
Note: See TracBrowser for help on using the repository browser.