1 #ifndef BOOST_SERIALIZATION_COMPLEX_HPP
2 #define BOOST_SERIALIZATION_COMPLEX_HPP
4 // MS compatible compilers support #pragma once
5 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // serialization/utility.hpp:
11 // serialization for stl utility templates
13 // (C) Copyright 2007 Matthias Troyer .
14 // Use, modification and distribution is subject to the Boost Software
15 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
16 // http://www.boost.org/LICENSE_1_0.txt)
18 // See http://www.boost.org for updates, documentation, and revision history.
21 #include <boost/config.hpp>
23 #include <boost/serialization/nvp.hpp>
24 #include <boost/serialization/is_bitwise_serializable.hpp>
25 #include <boost/serialization/split_free.hpp>
28 namespace serialization
{
30 template<class Archive
, class T
>
31 inline void serialize(
34 const unsigned int file_version
36 boost::serialization::split_free(ar
, t
, file_version
);
39 template<class Archive
, class T
>
42 std::complex<T
> const & t
,
43 const unsigned int /* file_version */
45 const T re
= t
.real();
46 const T im
= t
.imag();
47 ar
<< boost::serialization::make_nvp("real", re
);
48 ar
<< boost::serialization::make_nvp("imag", im
);
51 template<class Archive
, class T
>
55 const unsigned int /* file_version */
59 ar
>> boost::serialization::make_nvp("real", re
);
60 ar
>> boost::serialization::make_nvp("imag", im
);
61 t
= std::complex<T
>(re
,im
);
64 // specialization of serialization traits for complex
66 struct is_bitwise_serializable
<std::complex<T
> >
67 : public is_bitwise_serializable
<T
> {};
70 struct implementation_level
<std::complex<T
> >
71 : mpl::int_
<object_serializable
> {} ;
73 // treat complex just like builtin arithmetic types for tracking
75 struct tracking_level
<std::complex<T
> >
76 : mpl::int_
<track_never
> {} ;
81 #endif // BOOST_SERIALIZATION_COMPLEX_HPP