array.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef BOOST_SERIALIZATION_ARRAY_HPP
  2. #define BOOST_SERIALIZATION_ARRAY_HPP
  3. // (C) Copyright 2005 Matthias Troyer and Dave Abrahams
  4. // Use, modification and distribution is subject to the Boost Software
  5. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. // for serialization of <array>. If <array> not supported by the standard
  8. // library - this file becomes empty. This is to avoid breaking backward
  9. // compatibiliy for applications which used this header to support
  10. // serialization of native arrays. Code to serialize native arrays is
  11. // now always include by default. RR
  12. #include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
  13. #if defined(BOOST_NO_STDC_NAMESPACE)
  14. #include <iostream>
  15. #include <cstddef> // std::size_t
  16. namespace std{
  17. using ::size_t;
  18. } // namespace std
  19. #endif
  20. #include <boost/serialization/array_wrapper.hpp>
  21. #ifndef BOOST_NO_CXX11_HDR_ARRAY
  22. #include <array>
  23. #include <boost/serialization/nvp.hpp>
  24. namespace boost { namespace serialization {
  25. template <class Archive, class T, std::size_t N>
  26. void serialize(Archive& ar, std::array<T,N>& a, const unsigned int /* version */)
  27. {
  28. ar & boost::serialization::make_nvp(
  29. "elems",
  30. *static_cast<T (*)[N]>(static_cast<void *>(a.data()))
  31. );
  32. }
  33. } } // end namespace boost::serialization
  34. #endif // BOOST_NO_CXX11_HDR_ARRAY
  35. #endif //BOOST_SERIALIZATION_ARRAY_HPP