1 #ifndef BOOST_SERIALIZATION_LIST_HPP
2 #define BOOST_SERIALIZATION_LIST_HPP
4 // MS compatible compilers support #pragma once
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // list.hpp: serialization for stl list templates
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)
17 // See http://www.boost.org for updates, documentation, and revision history.
21 #include <boost/config.hpp>
23 #include <boost/serialization/collections_save_imp.hpp>
24 #include <boost/serialization/collections_load_imp.hpp>
26 #include <boost/archive/detail/basic_iarchive.hpp>
27 #include <boost/serialization/access.hpp>
28 #include <boost/serialization/nvp.hpp>
29 #include <boost/serialization/collection_size_type.hpp>
30 #include <boost/serialization/item_version_type.hpp>
31 #include <boost/serialization/split_free.hpp>
32 #include <boost/serialization/detail/stack_constructor.hpp>
35 namespace serialization {
37 template<class Archive, class U, class Allocator>
40 const std::list<U, Allocator> &t,
41 const unsigned int /* file_version */
43 boost::serialization::stl::save_collection<
45 std::list<U, Allocator>
49 template<class Archive, class U, class Allocator>
52 std::list<U, Allocator> &t,
53 const unsigned int /* file_version */
55 const boost::archive::library_version_type library_version(
56 ar.get_library_version()
58 // retrieve number of elements
59 item_version_type item_version(0);
60 collection_size_type count;
61 ar >> BOOST_SERIALIZATION_NVP(count);
62 if(boost::archive::library_version_type(3) < library_version){
63 ar >> BOOST_SERIALIZATION_NVP(item_version);
65 stl::collection_load_impl(ar, t, count, item_version);
68 // split non-intrusive serialization function member into separate
69 // non intrusive save/load member functions
70 template<class Archive, class U, class Allocator>
71 inline void serialize(
73 std::list<U, Allocator> & t,
74 const unsigned int file_version
76 boost::serialization::split_free(ar, t, file_version);
82 #include <boost/serialization/collection_traits.hpp>
84 BOOST_SERIALIZATION_COLLECTION_TRAITS(std::list)
86 #endif // BOOST_SERIALIZATION_LIST_HPP