| 1 | // Copyright Sebastian Ramacher, 2007. |
| 2 | // Distributed under the Boost Software License, Version 1.0. (See |
| 3 | // accompanying file LICENSE_1_0.txt or copy at |
| 4 | // http://www.boost.org/LICENSE_1_0.txt) |
| 5 | |
| 6 | #ifndef BOOST_PTR_CONTAINER_SERIALIZE_PTR_VECTOR_HPP |
| 7 | #define BOOST_PTR_CONTAINER_SERIALIZE_PTR_VECTOR_HPP |
| 8 | |
| 9 | #include <boost/ptr_container/detail/serialize_reversible_cont.hpp> |
| 10 | #include <boost/ptr_container/ptr_vector.hpp> |
| 11 | |
| 12 | namespace boost |
| 13 | { |
| 14 | |
| 15 | namespace serialization |
| 16 | { |
| 17 | |
| 18 | template<class Archive, class T, class CloneAllocator, class Allocator> |
| 19 | void load(Archive& ar, ptr_vector<T, CloneAllocator, Allocator>& c, unsigned int /*version*/) |
| 20 | { |
| 21 | typedef ptr_vector<T, CloneAllocator, Allocator> container_type; |
| 22 | typedef BOOST_DEDUCED_TYPENAME container_type::size_type size_type; |
| 23 | |
| 24 | size_type n; |
| 25 | ar >> boost::serialization::make_nvp( ptr_container_detail::count(), n ); |
| 26 | c.reserve(n); |
| 27 | |
| 28 | ptr_container_detail::load_helper(ar, c, n); |
| 29 | } |
| 30 | |
| 31 | template<class Archive, class T, class CloneAllocator, class Allocator> |
| 32 | void serialize(Archive& ar, ptr_vector<T, CloneAllocator, Allocator>& c, const unsigned int version) |
| 33 | { |
| 34 | core::split_free(ar, c, version); |
| 35 | } |
| 36 | |
| 37 | } // namespace serialization |
| 38 | } // namespace boost |
| 39 | |
| 40 | #endif |
| 41 | |