mirror of
https://github.com/USCiLab/cereal.git
synced 2025-10-18 01:45:52 +02:00
Made OutputBinding serializers
This commit is contained in:
@@ -29,7 +29,25 @@
|
||||
#include <cereal/archives/binary.hpp>
|
||||
#include <cereal/types/polymorphic.hpp>
|
||||
|
||||
struct MyType {};
|
||||
struct Base
|
||||
{
|
||||
virtual void foo() = 0;
|
||||
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct MyType : public Base
|
||||
{
|
||||
void foo() {}
|
||||
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
CEREAL_BIND_TO_ARCHIVES(MyType);
|
||||
|
||||
@@ -37,6 +55,16 @@ template <class T> void nop(T&&t) {}
|
||||
|
||||
int main()
|
||||
{
|
||||
cereal::BinaryOutputArchive archive(std::cout);
|
||||
//auto ptr = std::make_shared<MyType>();
|
||||
|
||||
|
||||
std::shared_ptr<int> const ptr(new int);
|
||||
|
||||
archive(cereal::detail::make_ptr_wrapper(ptr));
|
||||
|
||||
//cereal::detail::PtrWrapper<const std::unique_ptr<const MyType, cereal::detail::EmptyDeleter<const MyType> > &>
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user