the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 81 lines 2.2 kB view raw
1#ifndef BOOST_SERIALIZATION_COMPLEX_HPP 2#define BOOST_SERIALIZATION_COMPLEX_HPP 3 4// MS compatible compilers support #pragma once 5#if defined(_MSC_VER) && (_MSC_VER >= 1020) 6# pragma once 7#endif 8 9/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 10// serialization/utility.hpp: 11// serialization for stl utility templates 12 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) 17 18// See http://www.boost.org for updates, documentation, and revision history. 19 20#include <complex> 21#include <boost/config.hpp> 22 23#include <boost/serialization/nvp.hpp> 24#include <boost/serialization/is_bitwise_serializable.hpp> 25#include <boost/serialization/split_free.hpp> 26 27namespace boost { 28namespace serialization { 29 30template<class Archive, class T> 31inline void serialize( 32 Archive & ar, 33 std::complex< T > & t, 34 const unsigned int file_version 35){ 36 boost::serialization::split_free(ar, t, file_version); 37} 38 39template<class Archive, class T> 40inline void save( 41 Archive & ar, 42 std::complex< T > const & t, 43 const unsigned int /* file_version */ 44){ 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); 49} 50 51template<class Archive, class T> 52inline void load( 53 Archive & ar, 54 std::complex< T >& t, 55 const unsigned int /* file_version */ 56){ 57 T re; 58 T im; 59 ar >> boost::serialization::make_nvp("real", re); 60 ar >> boost::serialization::make_nvp("imag", im); 61 t = std::complex< T >(re,im); 62} 63 64// specialization of serialization traits for complex 65template <class T> 66struct is_bitwise_serializable<std::complex< T > > 67 : public is_bitwise_serializable< T > {}; 68 69template <class T> 70struct implementation_level<std::complex< T > > 71 : mpl::int_<object_serializable> {} ; 72 73// treat complex just like builtin arithmetic types for tracking 74template <class T> 75struct tracking_level<std::complex< T > > 76 : mpl::int_<track_never> {} ; 77 78} // serialization 79} // namespace boost 80 81#endif // BOOST_SERIALIZATION_COMPLEX_HPP