summaryrefslogtreecommitdiff
path: root/boost/serialization
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:08:07 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:09:00 +0900
commitb5c87084afaef42b2d058f68091be31988a6a874 (patch)
treeadef9a65870a41181687e11d57fdf98e7629de3c /boost/serialization
parent34bd32e225e2a8a94104489b31c42e5801cc1f4a (diff)
downloadboost-b5c87084afaef42b2d058f68091be31988a6a874.tar.gz
boost-b5c87084afaef42b2d058f68091be31988a6a874.tar.bz2
boost-b5c87084afaef42b2d058f68091be31988a6a874.zip
Imported Upstream version 1.64.0upstream/1.64.0
Change-Id: Id9212edd016dd55f21172c427aa7894d1d24148b Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/serialization')
-rw-r--r--boost/serialization/archive_input_unordered_map.hpp16
-rw-r--r--boost/serialization/archive_input_unordered_set.hpp17
-rw-r--r--boost/serialization/array.hpp150
-rw-r--r--boost/serialization/array_optimization.hpp37
-rw-r--r--boost/serialization/array_wrapper.hpp121
-rw-r--r--boost/serialization/boost_array.hpp33
-rw-r--r--boost/serialization/collections_load_imp.hpp3
-rw-r--r--boost/serialization/deque.hpp1
-rw-r--r--boost/serialization/detail/get_data.hpp59
-rw-r--r--boost/serialization/detail/stack_constructor.hpp4
-rw-r--r--boost/serialization/ephemeral.hpp1
-rw-r--r--boost/serialization/factory.hpp1
-rw-r--r--boost/serialization/forward_list.hpp12
-rw-r--r--boost/serialization/hash_map.hpp5
-rw-r--r--boost/serialization/hash_set.hpp5
-rw-r--r--boost/serialization/list.hpp1
-rw-r--r--boost/serialization/map.hpp7
-rw-r--r--boost/serialization/optional.hpp44
-rw-r--r--boost/serialization/priority_queue.hpp2
-rw-r--r--boost/serialization/queue.hpp2
-rw-r--r--boost/serialization/set.hpp7
-rw-r--r--boost/serialization/shared_ptr_helper.hpp7
-rw-r--r--boost/serialization/singleton.hpp22
-rw-r--r--boost/serialization/slist.hpp9
-rw-r--r--boost/serialization/stack.hpp2
-rw-r--r--boost/serialization/strong_typedef.hpp38
-rw-r--r--boost/serialization/unordered_collections_load_imp.hpp1
-rw-r--r--boost/serialization/valarray.hpp24
-rw-r--r--boost/serialization/vector.hpp16
29 files changed, 345 insertions, 302 deletions
diff --git a/boost/serialization/archive_input_unordered_map.hpp b/boost/serialization/archive_input_unordered_map.hpp
index ef0fd93ebd..ccf806b181 100644
--- a/boost/serialization/archive_input_unordered_map.hpp
+++ b/boost/serialization/archive_input_unordered_map.hpp
@@ -19,8 +19,10 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <boost/config.hpp>
-
+#include <boost/serialization/nvp.hpp>
+#include <boost/serialization/detail/stack_constructor.hpp>
#include <boost/serialization/utility.hpp>
+#include <boost/move/utility_core.hpp>
namespace boost {
namespace serialization {
@@ -39,11 +41,7 @@ struct archive_input_unordered_map
detail::stack_construct<Archive, type> t(ar, v);
ar >> boost::serialization::make_nvp("item", t.reference());
std::pair<typename Container::const_iterator, bool> result =
- #ifdef BOOST_NO_CXX11_HDR_UNORDERED_MAP
- s.insert(t.reference());
- #else
- s.emplace(t.reference());
- #endif
+ s.insert(boost::move(t.reference()));
// note: the following presumes that the map::value_type was NOT tracked
// in the archive. This is the usual case, but here there is no way
// to determine that.
@@ -69,11 +67,7 @@ struct archive_input_unordered_multimap
detail::stack_construct<Archive, type> t(ar, v);
ar >> boost::serialization::make_nvp("item", t.reference());
typename Container::const_iterator result =
- #ifdef BOOST_NO_CXX11_HDR_UNORDERED_MAP
- s.insert(t.reference());
- #else
- s.emplace(t.reference());
- #endif
+ s.insert(t.reference());
// note: the following presumes that the map::value_type was NOT tracked
// in the archive. This is the usual case, but here there is no way
// to determine that.
diff --git a/boost/serialization/archive_input_unordered_set.hpp b/boost/serialization/archive_input_unordered_set.hpp
index 961b58f1a8..7f0003cc6a 100644
--- a/boost/serialization/archive_input_unordered_set.hpp
+++ b/boost/serialization/archive_input_unordered_set.hpp
@@ -17,6 +17,11 @@
// See http://www.boost.org for updates, documentation, and revision history.
+#include <utility>
+#include <boost/serialization/nvp.hpp>
+#include <boost/serialization/detail/stack_constructor.hpp>
+#include <boost/move/utility_core.hpp>
+
namespace boost {
namespace serialization {
@@ -36,11 +41,7 @@ struct archive_input_unordered_set
// borland fails silently w/o full namespace
ar >> boost::serialization::make_nvp("item", t.reference());
std::pair<typename Container::const_iterator, bool> result =
- #ifdef BOOST_NO_CXX11_HDR_UNORDERED_SET
- s.insert(t.reference());
- #else
- s.emplace(t.reference());
- #endif
+ s.insert(boost::move(t.reference()));
if(result.second)
ar.reset_object_address(& (* result.first), & t.reference());
}
@@ -59,11 +60,7 @@ struct archive_input_unordered_multiset
detail::stack_construct<Archive, type> t(ar, v);
ar >> boost::serialization::make_nvp("item", t.reference());
typename Container::const_iterator result =
- #ifdef BOOST_NO_CXX11_HDR_UNORDERED_SET
- s.insert(t.reference());
- #else
- s.emplace(t.reference());
- #endif
+ s.insert(boost::move(t.reference()));
ar.reset_object_address(& (* result), & t.reference());
}
};
diff --git a/boost/serialization/array.hpp b/boost/serialization/array.hpp
index 2cd023aca9..61708b3075 100644
--- a/boost/serialization/array.hpp
+++ b/boost/serialization/array.hpp
@@ -6,136 +6,30 @@
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-//#include <iostream>
+// for serialization of <array>. If <array> not supported by the standard
+// library - this file becomes empty. This is to avoid breaking backward
+// compatibiliy for applications which used this header to support
+// serialization of native arrays. Code to serialize native arrays is
+// now always include by default. RR
#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
#if defined(BOOST_NO_STDC_NAMESPACE)
+
+#include <iostream>
+#include <cstddef> // std::size_t
namespace std{
using ::size_t;
} // namespace std
#endif
+#ifndef BOOST_NO_CXX11_HDR_ARRAY
+
+#include <array>
#include <boost/serialization/nvp.hpp>
-#include <boost/serialization/split_member.hpp>
-#include <boost/serialization/wrapper.hpp>
-#include <boost/serialization/collection_size_type.hpp>
-#include <boost/mpl/always.hpp>
-#include <boost/mpl/apply.hpp>
-#include <boost/mpl/bool_fwd.hpp>
-#include <boost/type_traits/remove_const.hpp>
-#include <boost/type_traits/is_integral.hpp>
-#include <boost/static_assert.hpp>
namespace boost { namespace serialization {
-// traits to specify whether to use an optimized array serialization
-
-template <class Archive>
-struct use_array_optimization : boost::mpl::always<boost::mpl::false_> {};
-
-template<class T>
-class array_wrapper :
- public wrapper_traits<const array_wrapper< T > >
-{
-private:
- array_wrapper & operator=(const array_wrapper & rhs);
-public:
- // note: I would like to make the copy constructor private but this breaks
- // make_array. So I try to make make_array a friend - but that doesn't
- // build. Need a C++ guru to explain this!
- template<class S>
- friend const boost::serialization::array_wrapper<T> make_array( T* t, S s);
-
- array_wrapper(const array_wrapper & rhs) :
- m_t(rhs.m_t),
- m_element_count(rhs.m_element_count)
- {}
-public:
- array_wrapper(T * t, std::size_t s) :
- m_t(t),
- m_element_count(s)
- {}
-
- // default implementation
- template<class Archive>
- void serialize_optimized(Archive &ar, const unsigned int, mpl::false_ ) const
- {
- // default implemention does the loop
- std::size_t c = count();
- T * t = address();
- while(0 < c--)
- ar & boost::serialization::make_nvp("item", *t++);
- }
-
- // optimized implementation
- template<class Archive>
- void serialize_optimized(Archive &ar, const unsigned int version, mpl::true_ )
- {
- boost::serialization::split_member(ar, *this, version);
- }
-
- // default implementation
- template<class Archive>
- void save(Archive &ar, const unsigned int version) const
- {
- ar.save_array(*this,version);
- }
-
- // default implementation
- template<class Archive>
- void load(Archive &ar, const unsigned int version)
- {
- ar.load_array(*this,version);
- }
-
- // default implementation
- template<class Archive>
- void serialize(Archive &ar, const unsigned int version)
- {
- typedef typename
- boost::serialization::use_array_optimization<Archive>::template apply<
- typename remove_const< T >::type
- >::type use_optimized;
- serialize_optimized(ar,version,use_optimized());
- }
-
- T * address() const
- {
- return m_t;
- }
-
- std::size_t count() const
- {
- return m_element_count;
- }
-
-private:
- T * const m_t;
- const std::size_t m_element_count;
-};
-
-template<class T, class S>
-inline
-const array_wrapper< T > make_array( T* t, S s){
- const array_wrapper< T > a(t, s);
- return a;
-}
-
-} } // end namespace boost::serialization
-
-// I can't figure out why BOOST_NO_CXX11_HDR_ARRAY
-// has been set for clang-11. So just make sure
-// it's reset now. Needs further research!!!
-
-#if defined(_LIBCPP_VERSION)
-#undef BOOST_NO_CXX11_HDR_ARRAY
-#endif
-
-#ifndef BOOST_NO_CXX11_HDR_ARRAY
-#include <array>
-namespace boost { namespace serialization {
-// 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 */)
{
@@ -146,27 +40,7 @@ void serialize(Archive& ar, std::array<T,N>& a, const unsigned int /* version */
}
} } // end namespace boost::serialization
-#endif
-
-#include <boost/array.hpp>
-
-namespace boost { namespace serialization {
-// 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);
-}
-
-} } // end namespace boost::serialization
-#define BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(Archive) \
-namespace boost { namespace serialization { \
-template <> struct use_array_optimization<Archive> { \
- template <class ValueType> \
- struct apply : boost::mpl::apply1<Archive::use_array_optimization \
- , typename boost::remove_const<ValueType>::type \
- >::type {}; \
-}; }}
+#endif // BOOST_NO_CXX11_HDR_ARRAY
#endif //BOOST_SERIALIZATION_ARRAY_HPP
diff --git a/boost/serialization/array_optimization.hpp b/boost/serialization/array_optimization.hpp
new file mode 100644
index 0000000000..40dffba871
--- /dev/null
+++ b/boost/serialization/array_optimization.hpp
@@ -0,0 +1,37 @@
+#ifndef BOOST_SERIALIZATION_ARRAY_OPTIMIZATON_HPP
+#define BOOST_SERIALIZATION_ARRAY_OPTIMIZATON_HPP
+
+// (C) Copyright 2005 Matthias Troyer and Dave Abrahams
+// Use, modification and distribution is subject to the Boost Software
+// 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
+
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{
+ using ::size_t;
+} // namespace std
+#endif
+
+#include <boost/mpl/always.hpp>
+#include <boost/mpl/apply.hpp>
+#include <boost/type_traits/remove_const.hpp>
+
+namespace boost { namespace serialization {
+
+template <class Archive>
+struct use_array_optimization : boost::mpl::always<boost::mpl::false_> {};
+
+} } // end namespace boost::serialization
+
+#define BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(Archive) \
+namespace boost { namespace serialization { \
+template <> struct use_array_optimization<Archive> { \
+ template <class ValueType> \
+ struct apply : boost::mpl::apply1<Archive::use_array_optimization \
+ , typename boost::remove_const<ValueType>::type \
+ >::type {}; \
+}; }}
+
+#endif //BOOST_SERIALIZATION_ARRAY_OPTIMIZATON_HPP
diff --git a/boost/serialization/array_wrapper.hpp b/boost/serialization/array_wrapper.hpp
new file mode 100644
index 0000000000..adf436e15b
--- /dev/null
+++ b/boost/serialization/array_wrapper.hpp
@@ -0,0 +1,121 @@
+#ifndef BOOST_SERIALIZATION_ARRAY_WRAPPER_HPP
+#define BOOST_SERIALIZATION_ARRAY_WRAPPER_HPP
+
+// (C) Copyright 2005 Matthias Troyer and Dave Abrahams
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+//#include <iostream>
+
+#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
+
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{
+ using ::size_t;
+} // namespace std
+#endif
+
+#include <boost/serialization/nvp.hpp>
+#include <boost/serialization/split_member.hpp>
+#include <boost/serialization/wrapper.hpp>
+#include <boost/serialization/collection_size_type.hpp>
+#include <boost/serialization/array_optimization.hpp>
+#include <boost/mpl/always.hpp>
+#include <boost/mpl/apply.hpp>
+#include <boost/mpl/bool_fwd.hpp>
+#include <boost/type_traits/remove_const.hpp>
+
+namespace boost { namespace serialization {
+
+template<class T>
+class array_wrapper :
+ public wrapper_traits<const array_wrapper< T > >
+{
+private:
+ array_wrapper & operator=(const array_wrapper & rhs);
+ // note: I would like to make the copy constructor private but this breaks
+ // make_array. So I make make_array a friend
+ template<class Tx, class S>
+ friend const boost::serialization::array_wrapper<Tx> make_array(Tx * t, S s);
+public:
+
+ array_wrapper(const array_wrapper & rhs) :
+ m_t(rhs.m_t),
+ m_element_count(rhs.m_element_count)
+ {}
+public:
+ array_wrapper(T * t, std::size_t s) :
+ m_t(t),
+ m_element_count(s)
+ {}
+
+ // default implementation
+ template<class Archive>
+ void serialize_optimized(Archive &ar, const unsigned int, mpl::false_ ) const
+ {
+ // default implemention does the loop
+ std::size_t c = count();
+ T * t = address();
+ while(0 < c--)
+ ar & boost::serialization::make_nvp("item", *t++);
+ }
+
+ // optimized implementation
+ template<class Archive>
+ void serialize_optimized(Archive &ar, const unsigned int version, mpl::true_ )
+ {
+ boost::serialization::split_member(ar, *this, version);
+ }
+
+ // default implementation
+ template<class Archive>
+ void save(Archive &ar, const unsigned int version) const
+ {
+ ar.save_array(*this,version);
+ }
+
+ // default implementation
+ template<class Archive>
+ void load(Archive &ar, const unsigned int version)
+ {
+ ar.load_array(*this,version);
+ }
+
+ // default implementation
+ template<class Archive>
+ void serialize(Archive &ar, const unsigned int version)
+ {
+ typedef typename
+ boost::serialization::use_array_optimization<Archive>::template apply<
+ typename remove_const< T >::type
+ >::type use_optimized;
+ serialize_optimized(ar,version,use_optimized());
+ }
+
+ T * address() const
+ {
+ return m_t;
+ }
+
+ std::size_t count() const
+ {
+ return m_element_count;
+ }
+
+private:
+ T * const m_t;
+ const std::size_t m_element_count;
+};
+
+template<class T, class S>
+inline
+const array_wrapper< T > make_array(T* t, S s){
+ const array_wrapper< T > a(t, s);
+ return a;
+}
+
+} } // end namespace boost::serialization
+
+
+#endif //BOOST_SERIALIZATION_ARRAY_WRAPPER_HPP
diff --git a/boost/serialization/boost_array.hpp b/boost/serialization/boost_array.hpp
new file mode 100644
index 0000000000..d564ff15de
--- /dev/null
+++ b/boost/serialization/boost_array.hpp
@@ -0,0 +1,33 @@
+#ifndef BOOST_SERIALIZATION_ARRAY_HPP
+#define BOOST_SERIALIZATION_ARRAY_HPP
+
+// (C) Copyright 2005 Matthias Troyer and Dave Abrahams
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+//#include <iostream>
+
+#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
+
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{
+ using ::size_t;
+} // namespace std
+#endif
+
+#include <boost/serialization/nvp.hpp>
+#include <boost/array.hpp>
+
+namespace boost { namespace serialization {
+// 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);
+}
+
+} } // end namespace boost::serialization
+
+
+#endif //BOOST_SERIALIZATION_ARRAY_HPP
diff --git a/boost/serialization/collections_load_imp.hpp b/boost/serialization/collections_load_imp.hpp
index 93d64d72b9..c3b165a837 100644
--- a/boost/serialization/collections_load_imp.hpp
+++ b/boost/serialization/collections_load_imp.hpp
@@ -40,6 +40,7 @@ namespace std{
#include <boost/serialization/item_version_type.hpp>
#include <boost/serialization/detail/is_default_constructible.hpp>
#include <boost/utility/enable_if.hpp>
+#include <boost/move/utility_core.hpp>
namespace boost{
namespace serialization {
@@ -93,7 +94,7 @@ collection_load_impl(
while(count-- > 0){
detail::stack_construct<Archive, typename T::value_type> u(ar, item_version);
ar >> boost::serialization::make_nvp("item", u.reference());
- t.push_back(u.reference());
+ t.push_back(boost::move(u.reference()));
ar.reset_object_address(& t.back() , & u.reference());
}
}
diff --git a/boost/serialization/deque.hpp b/boost/serialization/deque.hpp
index 4d0a21f55c..bba81364ce 100644
--- a/boost/serialization/deque.hpp
+++ b/boost/serialization/deque.hpp
@@ -24,7 +24,6 @@
#include <boost/serialization/collections_save_imp.hpp>
#include <boost/serialization/collections_load_imp.hpp>
-#include <boost/serialization/detail/stack_constructor.hpp>
#include <boost/serialization/split_free.hpp>
namespace boost {
diff --git a/boost/serialization/detail/get_data.hpp b/boost/serialization/detail/get_data.hpp
deleted file mode 100644
index 37da7fc3c4..0000000000
--- a/boost/serialization/detail/get_data.hpp
+++ /dev/null
@@ -1,59 +0,0 @@
-// (C) Copyright 2005 Matthias Troyer
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org for updates, documentation, and revision history.
-
-#ifndef BOOST_SERIALIZATION_DETAIL_GET_DATA_HPP
-#define BOOST_SERIALIZATION_DETAIL_GET_DATA_HPP
-
-// MS compatible compilers support #pragma once
-#if defined(_MSC_VER)
-# pragma once
-#endif
-
-#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
-#define STD _STLP_STD
-#else
-#define STD std
-#endif
-
-#include <vector>
-#include <valarray>
-
-namespace boost {
-namespace serialization {
-namespace detail {
-
-template <class T, class Allocator>
-T* get_data(STD::vector<T,Allocator>& v)
-{
- return v.empty() ? 0 : &(v[0]);
-}
-
-template <class T, class Allocator>
-T* get_data(STD::vector<T,Allocator> const & v)
-{
- return get_data(const_cast<STD::vector<T,Allocator>&>(v));
-}
-
-template <class T>
-T* get_data(STD::valarray<T>& v)
-{
- return v.size()==0 ? 0 : &(v[0]);
-}
-
-template <class T>
-const T* get_data(STD::valarray<T> const& v)
-{
- return get_data(const_cast<STD::valarray<T>&>(v));
-}
-
-} // detail
-} // serialization
-} // boost
-
-#undef STD
-
-#endif // BOOST_SERIALIZATION_DETAIL_GET_DATA_HPP
diff --git a/boost/serialization/detail/stack_constructor.hpp b/boost/serialization/detail/stack_constructor.hpp
index 806b8877d7..ae14832c6d 100644
--- a/boost/serialization/detail/stack_constructor.hpp
+++ b/boost/serialization/detail/stack_constructor.hpp
@@ -1,5 +1,5 @@
-#ifndef BOOST_SERIALIZATION_DETAIL_STACH_CONSTRUCTOR_HPP
-#define BOOST_SERIALIZATION_DETAIL_STACH_CONSTRUCTOR_HPP
+#ifndef BOOST_SERIALIZATION_DETAIL_STACK_CONSTRUCTOR_HPP
+#define BOOST_SERIALIZATION_DETAIL_STACK_CONSTRUCTOR_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
diff --git a/boost/serialization/ephemeral.hpp b/boost/serialization/ephemeral.hpp
index 09e5016124..3a422c30a3 100644
--- a/boost/serialization/ephemeral.hpp
+++ b/boost/serialization/ephemeral.hpp
@@ -2,7 +2,6 @@
#define BOOST_SERIALIZATION_EPHEMERAL_HPP
// MS compatible compilers support
-#pragma once
#if defined(_MSC_VER)
# pragma once
#endif
diff --git a/boost/serialization/factory.hpp b/boost/serialization/factory.hpp
index 916d75d7dd..db5b1a9226 100644
--- a/boost/serialization/factory.hpp
+++ b/boost/serialization/factory.hpp
@@ -21,6 +21,7 @@
#include <boost/preprocessor/control/if.hpp>
#include <boost/preprocessor/comparison/greater.hpp>
+#include <boost/assert.hpp>
namespace std{
#if defined(__LIBCOMO__)
diff --git a/boost/serialization/forward_list.hpp b/boost/serialization/forward_list.hpp
index e17405383c..b8a3c20a6e 100644
--- a/boost/serialization/forward_list.hpp
+++ b/boost/serialization/forward_list.hpp
@@ -16,14 +16,11 @@
// See http://www.boost.org for updates, documentation, and revision history.
+#include <boost/config.hpp>
+
#include <forward_list>
#include <iterator> // distance
-#include <boost/config.hpp>
-#ifdef BOOST_NO_CXX11_HDR_FORWARD_LIST
-#error "not supported for versions earlier than c++11
-#endif
-
#include <boost/serialization/collections_save_imp.hpp>
#include <boost/serialization/collections_load_imp.hpp>
#include <boost/archive/detail/basic_iarchive.hpp>
@@ -33,6 +30,7 @@
#include <boost/serialization/split_free.hpp>
#include <boost/serialization/detail/stack_constructor.hpp>
#include <boost/serialization/detail/is_default_constructible.hpp>
+#include <boost/move/utility_core.hpp>
namespace boost {
namespace serialization {
@@ -72,14 +70,14 @@ collection_load_impl(
t.clear();
boost::serialization::detail::stack_construct<Archive, T> u(ar, item_version);
ar >> boost::serialization::make_nvp("item", u.reference());
- t.emplace_front(u.reference());
+ t.push_front(boost::move(u.reference()));
typename std::forward_list<T, Allocator>::iterator last;
last = t.begin();
ar.reset_object_address(&(*t.begin()) , & u.reference());
while(--count > 0){
detail::stack_construct<Archive, T> u(ar, item_version);
ar >> boost::serialization::make_nvp("item", u.reference());
- last = t.emplace_after(last, u.reference());
+ last = t.insert_after(last, boost::move(u.reference()));
ar.reset_object_address(&(*last) , & u.reference());
}
}
diff --git a/boost/serialization/hash_map.hpp b/boost/serialization/hash_map.hpp
index 615ace8d8a..22626db683 100644
--- a/boost/serialization/hash_map.hpp
+++ b/boost/serialization/hash_map.hpp
@@ -25,6 +25,7 @@
#include <boost/serialization/hash_collections_save_imp.hpp>
#include <boost/serialization/hash_collections_load_imp.hpp>
#include <boost/serialization/split_free.hpp>
+#include <boost/move/utility_core.hpp>
namespace boost {
namespace serialization {
@@ -45,7 +46,7 @@ struct archive_input_hash_map
// borland fails silently w/o full namespace
ar >> boost::serialization::make_nvp("item", t.reference());
std::pair<typename Container::const_iterator, bool> result =
- s.insert(t.reference());
+ s.insert(boost::move(t.reference()));
// note: the following presumes that the map::value_type was NOT tracked
// in the archive. This is the usual case, but here there is no way
// to determine that.
@@ -72,7 +73,7 @@ struct archive_input_hash_multimap
// borland fails silently w/o full namespace
ar >> boost::serialization::make_nvp("item", t.reference());
typename Container::const_iterator result
- = s.insert(t.reference());
+ = s.insert(boost::move(t.reference()));
// note: the following presumes that the map::value_type was NOT tracked
// in the archive. This is the usual case, but here there is no way
// to determine that.
diff --git a/boost/serialization/hash_set.hpp b/boost/serialization/hash_set.hpp
index 6275e0309e..0c72c18457 100644
--- a/boost/serialization/hash_set.hpp
+++ b/boost/serialization/hash_set.hpp
@@ -23,6 +23,7 @@
#include <boost/serialization/hash_collections_save_imp.hpp>
#include <boost/serialization/hash_collections_load_imp.hpp>
#include <boost/serialization/split_free.hpp>
+#include <boost/move/utility_core.hpp>
namespace boost {
namespace serialization {
@@ -43,7 +44,7 @@ struct archive_input_hash_set
// borland fails silently w/o full namespace
ar >> boost::serialization::make_nvp("item", t.reference());
std::pair<typename Container::const_iterator, bool> result =
- s.insert(t.reference());
+ s.insert(boost::move(t.reference()));
if(result.second)
ar.reset_object_address(& (* result.first), & t.reference());
}
@@ -63,7 +64,7 @@ struct archive_input_hash_multiset
// borland fails silently w/o full namespace
ar >> boost::serialization::make_nvp("item", t.reference());
typename Container::const_iterator result
- = s.insert(t.reference());
+ = s.insert(boost::move(t.reference()));
ar.reset_object_address(& (* result), & t.reference());
}
};
diff --git a/boost/serialization/list.hpp b/boost/serialization/list.hpp
index 741dbbe73e..5fdc114d7e 100644
--- a/boost/serialization/list.hpp
+++ b/boost/serialization/list.hpp
@@ -29,7 +29,6 @@
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/item_version_type.hpp>
#include <boost/serialization/split_free.hpp>
-#include <boost/serialization/detail/stack_constructor.hpp>
namespace boost {
namespace serialization {
diff --git a/boost/serialization/map.hpp b/boost/serialization/map.hpp
index 2582f9aced..9209864c8c 100644
--- a/boost/serialization/map.hpp
+++ b/boost/serialization/map.hpp
@@ -31,6 +31,7 @@
#include <boost/serialization/utility.hpp>
#include <boost/serialization/collections_save_imp.hpp>
#include <boost/serialization/split_free.hpp>
+#include <boost/move/utility_core.hpp>
namespace boost {
namespace serialization {
@@ -59,11 +60,7 @@ inline void load_map_collection(Archive & ar, Container &s)
detail::stack_construct<Archive, type> t(ar, item_version);
ar >> boost::serialization::make_nvp("item", t.reference());
typename Container::iterator result =
- #ifdef BOOST_NO_CXX11_HDR_UNORDERED_MAP
- s.insert(hint, t.reference());
- #else
- s.emplace_hint(hint, t.reference());
- #endif
+ s.insert(hint, boost::move(t.reference()));
ar.reset_object_address(& (result->second), & t.reference().second);
hint = result;
++hint;
diff --git a/boost/serialization/optional.hpp b/boost/serialization/optional.hpp
index 4024cf5e61..ecd1756d50 100644
--- a/boost/serialization/optional.hpp
+++ b/boost/serialization/optional.hpp
@@ -19,12 +19,16 @@
#include <boost/archive/detail/basic_iarchive.hpp>
#include <boost/optional.hpp>
+#include <boost/move/utility_core.hpp>
+
#include <boost/serialization/item_version_type.hpp>
#include <boost/serialization/split_free.hpp>
#include <boost/serialization/level.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/version.hpp>
+#include <boost/type_traits/is_pointer.hpp>
#include <boost/serialization/detail/stack_constructor.hpp>
+#include <boost/serialization/detail/is_default_constructible.hpp>
// function specializations must be defined in the appropriate
// namespace - boost::serialization
@@ -37,6 +41,15 @@ void save(
const boost::optional< T > & t,
const unsigned int /*version*/
){
+ // It is an inherent limitation to the serialization of optional.hpp
+ // that the underlying type must be either a pointer or must have a
+ // default constructor. It's possible that this could change sometime
+ // in the future, but for now, one will have to work around it. This can
+ // be done by serialization the optional<T> as optional<T *>
+ BOOST_STATIC_ASSERT(
+ boost::serialization::detail::is_default_constructible<T>::value
+ || boost::is_pointer<T>::value
+ );
const bool tflag = t.is_initialized();
ar << boost::serialization::make_nvp("initialized", tflag);
if (tflag){
@@ -63,22 +76,25 @@ void load(
){
bool tflag;
ar >> boost::serialization::make_nvp("initialized", tflag);
- if (tflag){
- boost::serialization::item_version_type item_version(0);
- boost::archive::library_version_type library_version(
- ar.get_library_version()
- );
- if(boost::archive::library_version_type(3) < library_version){
- // item_version is handled as an attribute so it doesnt need an NVP
- ar >> BOOST_SERIALIZATION_NVP(item_version);
- }
- detail::stack_construct<Archive, T> aux(ar, item_version);
- ar >> boost::serialization::make_nvp("value", aux.reference());
- t.reset(aux.reference());
- }
- else {
+ if(! tflag){
t.reset();
+ return;
+ }
+
+ boost::serialization::item_version_type item_version(0);
+ boost::archive::library_version_type library_version(
+ ar.get_library_version()
+ );
+ if(boost::archive::library_version_type(3) < library_version){
+ ar >> BOOST_SERIALIZATION_NVP(item_version);
}
+ detail::stack_allocate<T> tp;
+ ar >> boost::serialization::make_nvp("value", tp.reference());
+ t.reset(boost::move(tp.reference()));
+ ar.reset_object_address(
+ t.get_ptr(),
+ & tp.reference()
+ );
}
template<class Archive, class T>
diff --git a/boost/serialization/priority_queue.hpp b/boost/serialization/priority_queue.hpp
index 3ba63a5b2d..5b08ffd1e8 100644
--- a/boost/serialization/priority_queue.hpp
+++ b/boost/serialization/priority_queue.hpp
@@ -18,6 +18,8 @@
#include <queue>
#include <boost/config.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/identity.hpp>
// function specializations must be defined in the appropriate
// namespace - boost::serialization
diff --git a/boost/serialization/queue.hpp b/boost/serialization/queue.hpp
index 58e1ee92f4..b22745215d 100644
--- a/boost/serialization/queue.hpp
+++ b/boost/serialization/queue.hpp
@@ -18,6 +18,8 @@
#include <queue>
#include <boost/config.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/identity.hpp>
// function specializations must be defined in the appropriate
// namespace - boost::serialization
diff --git a/boost/serialization/set.hpp b/boost/serialization/set.hpp
index 6b957d470e..643906c5aa 100644
--- a/boost/serialization/set.hpp
+++ b/boost/serialization/set.hpp
@@ -29,6 +29,7 @@
#include <boost/serialization/collections_save_imp.hpp>
#include <boost/serialization/split_free.hpp>
+#include <boost/move/utility_core.hpp>
namespace boost {
namespace serialization {
@@ -55,11 +56,7 @@ inline void load_set_collection(Archive & ar, Container &s)
// borland fails silently w/o full namespace
ar >> boost::serialization::make_nvp("item", t.reference());
typename Container::iterator result =
- #ifdef BOOST_NO_CXX11_HDR_UNORDERED_SET
- s.insert(hint, t.reference());
- #else
- s.emplace_hint(hint, t.reference());
- #endif
+ s.insert(hint, boost::move(t.reference()));
ar.reset_object_address(& (* result), & t.reference());
hint = result;
}
diff --git a/boost/serialization/shared_ptr_helper.hpp b/boost/serialization/shared_ptr_helper.hpp
index 189447a804..37c34d6b2c 100644
--- a/boost/serialization/shared_ptr_helper.hpp
+++ b/boost/serialization/shared_ptr_helper.hpp
@@ -31,9 +31,6 @@
#include <boost/serialization/throw_exception.hpp>
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/archive/archive_exception.hpp>
-#include <boost/archive/detail/decl.hpp>
-
-#include <boost/archive/detail/abi_prefix.hpp> // must be the last headern
namespace boost_132 {
template<class T> class shared_ptr;
@@ -94,7 +91,7 @@ public:
// by a change in load_construct_data below. It makes this file suitable
// only for loading pointers into a 1.33 or later boost system.
std::list<boost_132::shared_ptr<const void> > * m_pointers_132;
- BOOST_ARCHIVE_DECL void
+ void
append(const boost_132::shared_ptr<const void> & t){
if(NULL == m_pointers_132)
m_pointers_132 = new std::list<boost_132::shared_ptr<const void> >;
@@ -209,6 +206,4 @@ public:
} // namespace serialization
} // namespace boost
-#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
-
#endif // BOOST_SERIALIZATION_SHARED_PTR_HELPER_HPP
diff --git a/boost/serialization/singleton.hpp b/boost/serialization/singleton.hpp
index fcb79c3694..a40488c6df 100644
--- a/boost/serialization/singleton.hpp
+++ b/boost/serialization/singleton.hpp
@@ -85,11 +85,19 @@ class BOOST_SYMBOL_VISIBLE singleton_module :
public boost::noncopyable
{
private:
- static bool & get_lock();
+ BOOST_SERIALIZATION_DECL static bool & get_lock();
public:
- BOOST_SERIALIZATION_DECL static void lock();
- BOOST_SERIALIZATION_DECL static void unlock();
- BOOST_SERIALIZATION_DECL static bool is_locked();
+ static void lock(){
+ get_lock() = true;
+ }
+
+ static void unlock(){
+ get_lock() = false;
+ }
+
+ static bool is_locked(){
+ return get_lock();
+ }
};
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
@@ -111,6 +119,12 @@ bool detail::singleton_wrapper< T >::m_is_destroyed = false;
} // detail
+// note usage of BOOST_DLLEXPORT. These functions are in danger of
+// being eliminated by the optimizer when building an application in
+// release mode. Usage of the macro is meant to signal the compiler/linker
+// to avoid dropping these functions which seem to be unreferenced.
+// This usage is not related to autolinking.
+
template <class T>
class singleton : public singleton_module
{
diff --git a/boost/serialization/slist.hpp b/boost/serialization/slist.hpp
index af300683e0..d9b971bc4f 100644
--- a/boost/serialization/slist.hpp
+++ b/boost/serialization/slist.hpp
@@ -29,6 +29,7 @@
#include <boost/serialization/split_free.hpp>
#include <boost/serialization/detail/stack_constructor.hpp>
#include <boost/serialization/detail/is_default_constructible.hpp>
+#include <boost/move/utility_core.hpp>
namespace boost {
namespace serialization {
@@ -67,14 +68,14 @@ collection_load_impl(
t.clear();
boost::serialization::detail::stack_construct<Archive, T> u(ar, item_version);
ar >> boost::serialization::make_nvp("item", u.reference());
- t.push_front(u.reference());
+ t.push_front(boost::move(u.reference()));
typename BOOST_STD_EXTENSION_NAMESPACE::slist<T, Allocator>::iterator last;
last = t.begin();
ar.reset_object_address(&(*t.begin()) , & u.reference());
while(--count > 0){
detail::stack_construct<Archive, T> u(ar, item_version);
ar >> boost::serialization::make_nvp("item", u.reference());
- last = t.insert_after(last, u.reference());
+ last = t.insert_after(last, boost::move(u.reference()));
ar.reset_object_address(&(*last) , & u.reference());
}
}
@@ -109,14 +110,14 @@ inline void load(
t.clear();
boost::serialization::detail::stack_construct<Archive, U> u(ar, item_version);
ar >> boost::serialization::make_nvp("item", u.reference());
- t.push_front(u.reference());
+ t.push_front(boost::move(u.reference()));
typename BOOST_STD_EXTENSION_NAMESPACE::slist<U, Allocator>::iterator last;
last = t.begin();
ar.reset_object_address(&(*t.begin()) , & u.reference());
while(--count > 0){
detail::stack_construct<Archive, U> u(ar, item_version);
ar >> boost::serialization::make_nvp("item", u.reference());
- last = t.insert_after(last, u.reference());
+ last = t.insert_after(last, boost::move(u.reference()));
ar.reset_object_address(&(*last) , & u.reference());
}
}
diff --git a/boost/serialization/stack.hpp b/boost/serialization/stack.hpp
index aea3ba8e00..96f90fe876 100644
--- a/boost/serialization/stack.hpp
+++ b/boost/serialization/stack.hpp
@@ -18,6 +18,8 @@
#include <stack>
#include <boost/config.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/identity.hpp>
// function specializations must be defined in the appropriate
// namespace - boost::serialization
diff --git a/boost/serialization/strong_typedef.hpp b/boost/serialization/strong_typedef.hpp
index c1bf1844bf..fdd1b24c9c 100644
--- a/boost/serialization/strong_typedef.hpp
+++ b/boost/serialization/strong_typedef.hpp
@@ -10,6 +10,7 @@
// strong_typedef.hpp:
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
+// (C) Copyright 2016 Ashish Sadanandan
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -24,23 +25,26 @@
#include <boost/config.hpp>
#include <boost/operators.hpp>
-
-#define BOOST_STRONG_TYPEDEF(T, D) \
-struct D \
- : boost::totally_ordered1< D \
- , boost::totally_ordered2< D, T \
- > > \
-{ \
- T t; \
- explicit D(const T t_) : t(t_) {}; \
- D(): t() {}; \
- D(const D & t_) : t(t_.t){} \
- D & operator=(const D & rhs) { t = rhs.t; return *this;} \
- D & operator=(const T & rhs) { t = rhs; return *this;} \
- operator const T & () const {return t; } \
- operator T & () { return t; } \
- bool operator==(const D & rhs) const { return t == rhs.t; } \
- bool operator<(const D & rhs) const { return t < rhs.t; } \
+#include <boost/type_traits/has_nothrow_assign.hpp>
+#include <boost/type_traits/has_nothrow_constructor.hpp>
+#include <boost/type_traits/has_nothrow_copy.hpp>
+
+#define BOOST_STRONG_TYPEDEF(T, D) \
+struct D \
+ : boost::totally_ordered1< D \
+ , boost::totally_ordered2< D, T \
+ > > \
+{ \
+ T t; \
+ explicit D(const T& t_) BOOST_NOEXCEPT_IF(boost::has_nothrow_copy_constructor<T>::value) : t(t_) {} \
+ D() BOOST_NOEXCEPT_IF(boost::has_nothrow_default_constructor<T>::value) : t() {} \
+ D(const D & t_) BOOST_NOEXCEPT_IF(boost::has_nothrow_copy_constructor<T>::value) : t(t_.t) {} \
+ D& operator=(const D& rhs) BOOST_NOEXCEPT_IF(boost::has_nothrow_assign<T>::value) {t = rhs.t; return *this;} \
+ D& operator=(const T& rhs) BOOST_NOEXCEPT_IF(boost::has_nothrow_assign<T>::value) {t = rhs; return *this;} \
+ operator const T&() const {return t;} \
+ operator T&() {return t;} \
+ bool operator==(const D& rhs) const {return t == rhs.t;} \
+ bool operator<(const D& rhs) const {return t < rhs.t;} \
};
#endif // BOOST_SERIALIZATION_STRONG_TYPEDEF_HPP
diff --git a/boost/serialization/unordered_collections_load_imp.hpp b/boost/serialization/unordered_collections_load_imp.hpp
index 48c568d633..d56a423d18 100644
--- a/boost/serialization/unordered_collections_load_imp.hpp
+++ b/boost/serialization/unordered_collections_load_imp.hpp
@@ -33,7 +33,6 @@ namespace std{
#include <boost/archive/detail/basic_iarchive.hpp>
#include <boost/serialization/access.hpp>
#include <boost/serialization/nvp.hpp>
-#include <boost/serialization/detail/stack_constructor.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/item_version_type.hpp>
diff --git a/boost/serialization/valarray.hpp b/boost/serialization/valarray.hpp
index efe102f6cf..9eece5c173 100644
--- a/boost/serialization/valarray.hpp
+++ b/boost/serialization/valarray.hpp
@@ -18,10 +18,12 @@
#include <valarray>
#include <boost/config.hpp>
+
+#include <boost/serialization/collections_save_imp.hpp>
+#include <boost/serialization/collections_load_imp.hpp>
#include <boost/serialization/split_free.hpp>
-#include <boost/serialization/array.hpp>
#include <boost/serialization/collection_size_type.hpp>
-#include <boost/serialization/detail/get_data.hpp>
+#include <boost/serialization/array_wrapper.hpp>
// function specializations must be defined in the appropriate
// namespace - boost::serialization
@@ -42,8 +44,13 @@ void save( Archive & ar, const STD::valarray<U> &t, const unsigned int /*file_ve
{
const collection_size_type count(t.size());
ar << BOOST_SERIALIZATION_NVP(count);
- if (t.size())
- ar << make_array(detail::get_data(t), t.size());
+ if (t.size()){
+ // explict template arguments to pass intel C++ compiler
+ ar << serialization::make_array<const U, collection_size_type>(
+ static_cast<const U *>(&t[0]),
+ count
+ );
+ }
}
template<class Archive, class U>
@@ -52,8 +59,13 @@ void load( Archive & ar, STD::valarray<U> &t, const unsigned int /*file_version
collection_size_type count;
ar >> BOOST_SERIALIZATION_NVP(count);
t.resize(count);
- if (t.size())
- ar >> make_array(detail::get_data(t), t.size());
+ if (t.size()){
+ // explict template arguments to pass intel C++ compiler
+ ar >> serialization::make_array<U, collection_size_type>(
+ static_cast<U *>(&t[0]),
+ count
+ );
+ }
}
// split non-intrusive serialization function member into separate
diff --git a/boost/serialization/vector.hpp b/boost/serialization/vector.hpp
index a1737548ef..9a114c00e2 100644
--- a/boost/serialization/vector.hpp
+++ b/boost/serialization/vector.hpp
@@ -31,9 +31,7 @@
#include <boost/serialization/collections_save_imp.hpp>
#include <boost/serialization/collections_load_imp.hpp>
#include <boost/serialization/split_free.hpp>
-#include <boost/serialization/array.hpp>
-#include <boost/serialization/detail/get_data.hpp>
-#include <boost/serialization/detail/stack_constructor.hpp>
+#include <boost/serialization/array_wrapper.hpp>
#include <boost/mpl/bool_fwd.hpp>
#include <boost/mpl/if.hpp>
@@ -103,7 +101,11 @@ inline void save(
const collection_size_type count(t.size());
ar << BOOST_SERIALIZATION_NVP(count);
if (!t.empty())
- ar << boost::serialization::make_array(detail::get_data(t),t.size());
+ // explict template arguments to pass intel C++ compiler
+ ar << serialization::make_array<const U, collection_size_type>(
+ static_cast<const U *>(&t[0]),
+ count
+ );
}
template<class Archive, class U, class Allocator>
@@ -121,7 +123,11 @@ inline void load(
ar >> BOOST_SERIALIZATION_NVP(item_version);
}
if (!t.empty())
- ar >> boost::serialization::make_array(detail::get_data(t),t.size());
+ // explict template arguments to pass intel C++ compiler
+ ar >> serialization::make_array<U, collection_size_type>(
+ static_cast<U *>(&t[0]),
+ count
+ );
}
// dispatch to either default or optimized versions