boost_unordered_set.hpp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. #ifndef BOOST_SERIALIZATION_BOOST_UNORDERED_SET_HPP
  2. #define BOOST_SERIALIZATION_BOOST_UNORDERED_SET_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. // unordered_set.hpp: serialization for boost unordered_set templates
  9. // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
  10. // (C) Copyright 2014 Jim Bell
  11. // Use, modification and distribution is subject to the Boost Software
  12. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  13. // http://www.boost.org/LICENSE_1_0.txt)
  14. // See http://www.boost.org for updates, documentation, and revision history.
  15. #include <boost/config.hpp>
  16. #include <boost/unordered_set.hpp>
  17. #include <boost/serialization/unordered_collections_save_imp.hpp>
  18. #include <boost/serialization/unordered_collections_load_imp.hpp>
  19. #include <boost/serialization/archive_input_unordered_set.hpp>
  20. #include <boost/serialization/split_free.hpp>
  21. namespace boost {
  22. namespace serialization {
  23. template<
  24. class Archive,
  25. class Key,
  26. class HashFcn,
  27. class EqualKey,
  28. class Allocator
  29. >
  30. inline void save(
  31. Archive & ar,
  32. const boost::unordered_set<Key, HashFcn, EqualKey, Allocator> &t,
  33. const unsigned int /*file_version*/
  34. ){
  35. boost::serialization::stl::save_unordered_collection<
  36. Archive,
  37. boost::unordered_set<Key, HashFcn, EqualKey, Allocator>
  38. >(ar, t);
  39. }
  40. template<
  41. class Archive,
  42. class Key,
  43. class HashFcn,
  44. class EqualKey,
  45. class Allocator
  46. >
  47. inline void load(
  48. Archive & ar,
  49. boost::unordered_set<Key, HashFcn, EqualKey, Allocator> &t,
  50. const unsigned int /*file_version*/
  51. ){
  52. boost::serialization::stl::load_unordered_collection<
  53. Archive,
  54. boost::unordered_set<Key, HashFcn, EqualKey, Allocator>,
  55. boost::serialization::stl::archive_input_unordered_set<
  56. Archive,
  57. boost::unordered_set<Key, HashFcn, EqualKey, Allocator>
  58. >
  59. >(ar, t);
  60. }
  61. // split non-intrusive serialization function member into separate
  62. // non intrusive save/load member functions
  63. template<
  64. class Archive,
  65. class Key,
  66. class HashFcn,
  67. class EqualKey,
  68. class Allocator
  69. >
  70. inline void serialize(
  71. Archive & ar,
  72. boost::unordered_set<Key, HashFcn, EqualKey, Allocator> &t,
  73. const unsigned int file_version
  74. ){
  75. boost::serialization::split_free(ar, t, file_version);
  76. }
  77. // unordered_multiset
  78. template<
  79. class Archive,
  80. class Key,
  81. class HashFcn,
  82. class EqualKey,
  83. class Allocator
  84. >
  85. inline void save(
  86. Archive & ar,
  87. const boost::unordered_multiset<Key, HashFcn, EqualKey, Allocator> &t,
  88. const unsigned int /*file_version*/
  89. ){
  90. boost::serialization::stl::save_unordered_collection<
  91. Archive,
  92. boost::unordered_multiset<Key, HashFcn, EqualKey, Allocator>
  93. >(ar, t);
  94. }
  95. template<
  96. class Archive,
  97. class Key,
  98. class HashFcn,
  99. class EqualKey,
  100. class Allocator
  101. >
  102. inline void load(
  103. Archive & ar,
  104. boost::unordered_multiset<Key, HashFcn, EqualKey, Allocator> &t,
  105. const unsigned int /*file_version*/
  106. ){
  107. boost::serialization::stl::load_unordered_collection<
  108. Archive,
  109. boost::unordered_multiset<Key, HashFcn, EqualKey, Allocator>,
  110. boost::serialization::stl::archive_input_unordered_multiset<
  111. Archive,
  112. boost::unordered_multiset<Key, HashFcn, EqualKey, Allocator>
  113. >
  114. >(ar, t);
  115. }
  116. // split non-intrusive serialization function member into separate
  117. // non intrusive save/load member functions
  118. template<
  119. class Archive,
  120. class Key,
  121. class HashFcn,
  122. class EqualKey,
  123. class Allocator
  124. >
  125. inline void serialize(
  126. Archive & ar,
  127. boost::unordered_multiset<Key, HashFcn, EqualKey, Allocator> &t,
  128. const unsigned int file_version
  129. ){
  130. boost::serialization::split_free(ar, t, file_version);
  131. }
  132. } // namespace serialization
  133. } // namespace boost
  134. #endif // BOOST_SERIALIZATION_BOOST_UNORDERED_SET_HPP