list.hpp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef BOOST_SERIALIZATION_LIST_HPP
  2. #define BOOST_SERIALIZATION_LIST_HPP
  3. // MS compatible compilers support #pragma once
  4. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  5. # pragma once
  6. #endif
  7. /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
  8. // list.hpp: serialization for stl list templates
  9. // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
  10. // Use, modification and distribution is subject to the Boost Software
  11. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  12. // http://www.boost.org/LICENSE_1_0.txt)
  13. // See http://www.boost.org for updates, documentation, and revision history.
  14. #include <list>
  15. #include <boost/config.hpp>
  16. #include <boost/serialization/collections_save_imp.hpp>
  17. #include <boost/serialization/collections_load_imp.hpp>
  18. #include <boost/serialization/split_free.hpp>
  19. namespace boost {
  20. namespace serialization {
  21. template<class Archive, class U, class Allocator>
  22. inline void save(
  23. Archive & ar,
  24. const std::list<U, Allocator> &t,
  25. const unsigned int /* file_version */
  26. ){
  27. boost::serialization::stl::save_collection<
  28. Archive,
  29. std::list<U, Allocator>
  30. >(ar, t);
  31. }
  32. template<class Archive, class U, class Allocator>
  33. inline void load(
  34. Archive & ar,
  35. std::list<U, Allocator> &t,
  36. const unsigned int /* file_version */
  37. ){
  38. boost::serialization::stl::load_collection<
  39. Archive,
  40. std::list<U, Allocator>,
  41. boost::serialization::stl::archive_input_seq<
  42. Archive,
  43. std::list<U, Allocator>
  44. >,
  45. boost::serialization::stl::no_reserve_imp<std::list<U, Allocator> >
  46. >(ar, t);
  47. }
  48. // split non-intrusive serialization function member into separate
  49. // non intrusive save/load member functions
  50. template<class Archive, class U, class Allocator>
  51. inline void serialize(
  52. Archive & ar,
  53. std::list<U, Allocator> & t,
  54. const unsigned int file_version
  55. ){
  56. boost::serialization::split_free(ar, t, file_version);
  57. }
  58. } // serialization
  59. } // namespace boost
  60. #include <boost/serialization/collection_traits.hpp>
  61. BOOST_SERIALIZATION_COLLECTION_TRAITS(std::list)
  62. #endif // BOOST_SERIALIZATION_LIST_HPP