mirror of
https://github.com/USCiLab/cereal.git
synced 2025-10-18 01:45:52 +02:00
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
This commit is contained in:
28
binary_archive/complex.hpp
Normal file
28
binary_archive/complex.hpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#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_
|
||||
Reference in New Issue
Block a user