cereal/binary_archive/complex.hpp
Shane Grant 0c56175a1c Adding bitset and complex, both untested
This makes us "feature complete (tm)" as far as things that look worth serializing in the standard library

just need the unit tests for these then we can profile size and speed vs boost
2013-06-15 23:26:47 -07:00

29 lines
673 B
C++

#ifndef CEREAL_BINARY_ARCHIVE_COMPLEX_HPP_
#define CEREAL_BINARY_ARCHIVE_COMPLEX_HPP_
#include <cereal/binary_archive/binary_archive.hpp>
#include <complex>
namespace cereal
{
//! Serializing (save) for std::complex to binary
template <class T> inline
void save( BinaryOutputArchive & ar, std::complex<T> const & comp )
{
ar & comp.real();
ar & comp.imag();
}
//! Serializing (load) for std::complex to binary
template <class T> inline
void load( BinaryInputArchive & ar, std::complex<T> & bits )
{
T real, imag;
ar & real;
ar & imag;
bits = {real, imag};
}
} // namespace cereal
#endif // CEREAL_BINARY_ARCHIVE_COMPLEX_HPP_