summaryrefslogtreecommitdiff
path: root/boost/serialization/array.hpp
diff options
context:
space:
mode:
authorChanho Park <chanho61.park@samsung.com>2014-12-11 18:55:56 +0900
committerChanho Park <chanho61.park@samsung.com>2014-12-11 18:55:56 +0900
commit08c1e93fa36a49f49325a07fe91ff92c964c2b6c (patch)
tree7a7053ceb8874b28ec4b868d4c49b500008a102e /boost/serialization/array.hpp
parentbb4dd8289b351fae6b55e303f189127a394a1edd (diff)
downloadboost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.gz
boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.bz2
boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.zip
Imported Upstream version 1.57.0upstream/1.57.0
Diffstat (limited to 'boost/serialization/array.hpp')
-rw-r--r--boost/serialization/array.hpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/boost/serialization/array.hpp b/boost/serialization/array.hpp
index 3391a96f51..35c640ce45 100644
--- a/boost/serialization/array.hpp
+++ b/boost/serialization/array.hpp
@@ -6,10 +6,14 @@
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
+#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
+
#include <iostream>
#include <cstddef> // std::size_t
-#include <cstddef>
-#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
+#ifndef BOOST_NO_CXX11_HDR_ARRAY
+#include <array>
+#endif
+
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::size_t;
@@ -97,9 +101,9 @@ public:
template<class Archive>
void serialize(Archive &ar, const unsigned int version)
{
- typedef BOOST_DEDUCED_TYPENAME
+ typedef typename
boost::serialization::use_array_optimization<Archive>::template apply<
- BOOST_DEDUCED_TYPENAME remove_const< T >::type
+ typename remove_const< T >::type
>::type use_optimized;
serialize_optimized(ar,version,use_optimized());
}
@@ -128,12 +132,26 @@ array< T > make_array( T* t, std::size_t s){
return array< T >(t, s);
}
+// implement serialization for boost::array
template <class Archive, class T, std::size_t N>
void serialize(Archive& ar, boost::array<T,N>& a, const unsigned int /* version */)
{
- ar & boost::serialization::make_nvp("elems",a.elems);
+ ar & boost::serialization::make_nvp("elems", a.elems);
}
+#ifndef BOOST_NO_CXX11_HDR_ARRAY
+// implement serialization for std::array
+template <class Archive, class T, std::size_t N>
+void serialize(Archive& ar, std::array<T,N>& a, const unsigned int /* version */)
+{
+ ar & boost::serialization::make_nvp(
+ "elems",
+ *static_cast<T (*)[N]>(static_cast<void *>(a.data()))
+ );
+
+}
+#endif
+
} } // end namespace boost::serialization
#ifdef __BORLANDC__
@@ -145,7 +163,7 @@ namespace boost { namespace serialization { \
template <> struct use_array_optimization<Archive> { \
template <class ValueType> \
struct apply : boost::mpl::apply1<Archive::use_array_optimization \
- , BOOST_DEDUCED_TYPENAME boost::remove_const<ValueType>::type \
+ , typename boost::remove_const<ValueType>::type \
>::type {}; \
}; }}
#endif // __BORLANDC__