1 #ifndef BOOST_SERIALIZATION_COLLECTIONS_LOAD_IMP_HPP
2 #define BOOST_SERIALIZATION_COLLECTIONS_LOAD_IMP_HPP
4 // MS compatible compilers support #pragma once
9 #if defined(_MSC_VER) && (_MSC_VER <= 1020)
10 # pragma warning (disable : 4786) // too long name, harmless warning
13 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
14 // collections_load_imp.hpp: serialization for loading stl collections
16 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
17 // Use, modification and distribution is subject to the Boost Software
18 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
19 // http://www.boost.org/LICENSE_1_0.txt)
21 // See http://www.boost.org for updates, documentation, and revision history.
23 // helper function templates for serialization of collections
25 #include <boost/assert.hpp>
26 #include <cstddef> // size_t
27 #include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
28 #if defined(BOOST_NO_STDC_NAMESPACE)
33 #include <boost/detail/workaround.hpp>
35 #include <boost/archive/detail/basic_iarchive.hpp>
36 #include <boost/serialization/access.hpp>
37 #include <boost/serialization/nvp.hpp>
38 #include <boost/serialization/detail/stack_constructor.hpp>
39 #include <boost/serialization/collection_size_type.hpp>
40 #include <boost/serialization/item_version_type.hpp>
41 #include <boost/serialization/detail/is_default_constructible.hpp>
42 #include <boost/utility/enable_if.hpp>
45 namespace serialization {
48 //////////////////////////////////////////////////////////////////////
49 // implementation of serialization for STL containers
56 typename boost::enable_if<
57 typename detail::is_default_constructible<
58 typename T::value_type
65 collection_size_type count,
69 typename T::iterator hint;
72 ar >> boost::serialization::make_nvp("item", *hint++);
80 typename boost::disable_if<
81 typename detail::is_default_constructible<
82 typename T::value_type
89 collection_size_type count,
90 item_version_type item_version
94 detail::stack_construct<Archive, typename T::value_type> u(ar, item_version);
95 ar >> boost::serialization::make_nvp("item", u.reference());
96 t.push_back(u.reference());
97 ar.reset_object_address(& t.back() , & u.reference());
102 } // namespace serialization
105 #endif //BOOST_SERIALIZATION_COLLECTIONS_LOAD_IMP_HPP