From 9d4f51ee103798eb1305a8b67dfa2904681173d9 Mon Sep 17 00:00:00 2001 From: Shane Grant Date: Wed, 22 Jan 2014 14:44:18 -0800 Subject: [PATCH] Also for #44, need to test type_traits on load_and_allocate --- include/cereal/details/helpers.hpp | 5 +++-- sandbox_vs.cpp | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/cereal/details/helpers.hpp b/include/cereal/details/helpers.hpp index c5066d1c0..e1aaefc0c 100644 --- a/include/cereal/details/helpers.hpp +++ b/include/cereal/details/helpers.hpp @@ -327,6 +327,8 @@ namespace cereal }; } // namespace detail + // forward decl + namespace memory_detail{ template struct LoadAndAllocateLoadWrapper; } //! Used to allocate types with no default constructor /*! When serializing a type that has no default constructor, cereal @@ -347,7 +349,7 @@ namespace cereal } private: - template friend struct memory_detail::LoadAndAllocateLoadWrapper; + template friend struct ::cereal::memory_detail::LoadAndAllocateLoadWrapper; allocate( T * p ) : ptr( p ) {} allocate( allocate const & ) = delete; @@ -355,7 +357,6 @@ namespace cereal T * ptr; }; - } // namespace cereal #endif // CEREAL_DETAILS_HELPERS_HPP_ diff --git a/sandbox_vs.cpp b/sandbox_vs.cpp index 84b28b7f4..c9ce2e9f9 100644 --- a/sandbox_vs.cpp +++ b/sandbox_vs.cpp @@ -87,9 +87,9 @@ namespace cereal struct LoadAndAllocate { template - static Test * load_and_allocate( Archive & ) + static void load_and_allocate( Archive &, cereal::allocate & allocate ) { - return new Test(); + allocate(); } }; }