1 #ifndef BOOST_SERIALIZATION_SLIST_HPP
2 #define BOOST_SERIALIZATION_SLIST_HPP
4 // MS compatible compilers support #pragma once
5 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
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.
19 #include <cstddef> // size_t
20 #include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
21 #if defined(BOOST_NO_STDC_NAMESPACE)
27 #ifdef BOOST_HAS_SLIST
28 #include BOOST_SLIST_HEADER
30 #include <boost/serialization/collections_save_imp.hpp>
31 #include <boost/serialization/collections_load_imp.hpp>
32 #include <boost/serialization/split_free.hpp>
33 #include <boost/serialization/nvp.hpp>
36 namespace serialization
{
38 template<class Archive
, class U
, class Allocator
>
41 const BOOST_STD_EXTENSION_NAMESPACE::slist
<U
, Allocator
> &t
,
42 const unsigned int file_version
44 boost::serialization::stl::save_collection
<
46 BOOST_STD_EXTENSION_NAMESPACE::slist
<U
, Allocator
>
50 template<class Archive
, class U
, class Allocator
>
53 BOOST_STD_EXTENSION_NAMESPACE::slist
<U
, Allocator
> &t
,
54 const unsigned int file_version
56 // retrieve number of elements
58 // retrieve number of elements
59 collection_size_type count
;
60 ar
>> BOOST_SERIALIZATION_NVP(count
);
61 if(std::size_t(0) == count
)
64 if(3 < ar
.get_library_version()){
65 ar
>> boost::serialization::make_nvp("item_version", v
);
67 boost::serialization::detail::stack_construct
<Archive
, U
> u(ar
, v
);
68 ar
>> boost::serialization::make_nvp("item", u
.reference());
69 t
.push_front(u
.reference());
70 BOOST_DEDUCED_TYPENAME
BOOST_STD_EXTENSION_NAMESPACE::slist
<U
, Allocator
>::iterator last
;
72 std::size_t c
= count
;
74 boost::serialization::detail::stack_construct
<Archive
, U
>
76 ar
>> boost::serialization::make_nvp("item", u
.reference());
77 last
= t
.insert_after(last
, u
.reference());
78 ar
.reset_object_address(& (*last
), & u
.reference());
82 // split non-intrusive serialization function member into separate
83 // non intrusive save/load member functions
84 template<class Archive
, class U
, class Allocator
>
85 inline void serialize(
87 BOOST_STD_EXTENSION_NAMESPACE::slist
<U
, Allocator
> &t
,
88 const unsigned int file_version
90 boost::serialization::split_free(ar
, t
, file_version
);
96 #include <boost/serialization/collection_traits.hpp>
98 BOOST_SERIALIZATION_COLLECTION_TRAITS(BOOST_STD_EXTENSION_NAMESPACE::slist
)
100 #endif // BOOST_HAS_SLIST
101 #endif // BOOST_SERIALIZATION_SLIST_HPP