serialize_ptr_circular_buffer.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //
  2. // Boost.Pointer Container
  3. //
  4. // Copyright Thorsten Ottosen 2008. Use, modification and
  5. // distribution is subject to the Boost Software License, Version
  6. // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //
  9. // For more information, see http://www.boost.org/libs/ptr_container/
  10. //
  11. #ifndef BOOST_PTR_CONTAINER_SERIALIZE_PTR_CIRCULAR_BUFFER_HPP
  12. #define BOOST_PTR_CONTAINER_SERIALIZE_PTR_CIRCULAR_BUFFER_HPP
  13. #include <boost/ptr_container/detail/serialize_reversible_cont.hpp>
  14. #include <boost/ptr_container/ptr_circular_buffer.hpp>
  15. namespace boost
  16. {
  17. namespace serialization
  18. {
  19. template<class Archive, class T, class CloneAllocator, class Allocator>
  20. void load(Archive& ar, ptr_circular_buffer<T, CloneAllocator, Allocator>& c, unsigned int version)
  21. {
  22. typedef ptr_circular_buffer<T, CloneAllocator, Allocator> container_type;
  23. typedef BOOST_DEDUCED_TYPENAME container_type::size_type size_type;
  24. size_type n;
  25. ar >> boost::serialization::make_nvp( ptr_container_detail::count(), n );
  26. c.reserve(n);
  27. ptr_container_detail::load_helper(ar, c, n);
  28. }
  29. template<class Archive, class T, class CloneAllocator, class Allocator>
  30. void serialize(Archive& ar, ptr_circular_buffer<T, CloneAllocator, Allocator>& c, const unsigned int version)
  31. {
  32. core::split_free(ar, c, version);
  33. }
  34. } // namespace serialization
  35. } // namespace boost
  36. #endif