Pack required boost code together.
[xy_vsfilter.git] / src / thirdparty / boost_1_47_0 / boost / serialization / valarray.hpp
blob7e01eafb99b1132cfa9e48a1710d22a91dcb4a57
1 #ifndef BOOST_SERIALIZATION_VALARAY_HPP
2 #define BOOST_SERIALIZATION_VALARAY_HPP
4 // MS compatible compilers support #pragma once
5 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
6 # pragma once
7 #endif
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // valarray.hpp: serialization for stl vector templates
12 // (C) Copyright 2005 Matthias Troyer .
13 // Use, modification and distribution is subject to the Boost Software
14 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
17 // See http://www.boost.org for updates, documentation, and revision history.
19 #include <valarray>
20 #include <boost/config.hpp>
21 #include <boost/serialization/split_free.hpp>
22 #include <boost/serialization/array.hpp>
23 #include <boost/serialization/collection_size_type.hpp>
24 #include <boost/serialization/detail/get_data.hpp>
26 // function specializations must be defined in the appropriate
27 // namespace - boost::serialization
28 #if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
29 #define STD _STLP_STD
30 #else
31 #define STD std
32 #endif
34 namespace boost { namespace serialization {
36 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
37 // valarray< T >
39 template<class Archive, class U>
40 void save( Archive & ar, const STD::valarray<U> &t, const unsigned int /*file_version*/ )
42 const collection_size_type count(t.size());
43 ar << BOOST_SERIALIZATION_NVP(count);
44 if (t.size())
45 ar << make_array(detail::get_data(t), t.size());
49 template<class Archive, class U>
50 void load( Archive & ar, STD::valarray<U> &t, const unsigned int /*file_version*/ )
52 collection_size_type count;
53 ar >> BOOST_SERIALIZATION_NVP(count);
54 t.resize(count);
55 if (t.size())
56 ar >> make_array(detail::get_data(t), t.size());
59 // split non-intrusive serialization function member into separate
60 // non intrusive save/load member functions
61 template<class Archive, class U>
62 inline void serialize( Archive & ar, STD::valarray<U> & t, const unsigned int file_version)
64 boost::serialization::split_free(ar, t, file_version);
67 } } // end namespace boost::serialization
69 #include <boost/serialization/collection_traits.hpp>
71 BOOST_SERIALIZATION_COLLECTION_TRAITS(STD::valarray)
72 #undef STD
74 #endif // BOOST_SERIALIZATION_VALARAY_HPP