File indexing completed on 2024-11-15 09:31:00
0001 #ifndef BOOST_SERIALIZATION_COMPLEX_HPP
0002 #define BOOST_SERIALIZATION_COMPLEX_HPP
0003
0004
0005 #if defined(_MSC_VER)
0006 # pragma once
0007 #endif
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include <complex>
0021 #include <boost/config.hpp>
0022
0023 #include <boost/serialization/nvp.hpp>
0024 #include <boost/serialization/is_bitwise_serializable.hpp>
0025 #include <boost/serialization/split_free.hpp>
0026
0027 namespace boost {
0028 namespace serialization {
0029
0030 template<class Archive, class T>
0031 inline void serialize(
0032 Archive & ar,
0033 std::complex< T > & t,
0034 const unsigned int file_version
0035 ){
0036 boost::serialization::split_free(ar, t, file_version);
0037 }
0038
0039 template<class Archive, class T>
0040 inline void save(
0041 Archive & ar,
0042 std::complex< T > const & t,
0043 const unsigned int
0044 ){
0045 const T re = t.real();
0046 const T im = t.imag();
0047 ar << boost::serialization::make_nvp("real", re);
0048 ar << boost::serialization::make_nvp("imag", im);
0049 }
0050
0051 template<class Archive, class T>
0052 inline void load(
0053 Archive & ar,
0054 std::complex< T >& t,
0055 const unsigned int
0056 ){
0057 T re;
0058 T im;
0059 ar >> boost::serialization::make_nvp("real", re);
0060 ar >> boost::serialization::make_nvp("imag", im);
0061 t = std::complex< T >(re,im);
0062 }
0063
0064
0065 template <class T>
0066 struct is_bitwise_serializable<std::complex< T > >
0067 : public is_bitwise_serializable< T > {};
0068
0069 template <class T>
0070 struct implementation_level<std::complex< T > >
0071 : mpl::int_<object_serializable> {} ;
0072
0073
0074 template <class T>
0075 struct tracking_level<std::complex< T > >
0076 : mpl::int_<track_never> {} ;
0077
0078 }
0079 }
0080
0081 #endif