citra/src/common/serialization/atomic.h

29 lines
649 B
C++
Raw Normal View History

2019-08-11 01:20:09 +02:00
#pragma once
#include <atomic>
#include <boost/serialization/split_free.hpp>
namespace boost::serialization {
template <class Archive, class T>
void serialize(Archive& ar, std::atomic<T>& value, const unsigned int file_version)
2019-08-11 01:20:09 +02:00
{
boost::serialization::split_free(ar, value, file_version);
}
2019-08-11 01:20:09 +02:00
template <class Archive, class T>
void save(Archive& ar, const std::atomic<T>& value, const unsigned int file_version)
{
ar << value.load();
}
2019-08-11 01:20:09 +02:00
template <class Archive, class T>
void load(Archive& ar, std::atomic<T>& value, const unsigned int file_version)
{
T tmp;
ar >> tmp;
value.store(tmp);
}
2019-08-11 01:20:09 +02:00
} // namespace boost::serialization