From 30a22fec280b56b796bc635ab829c881788c6fe7 Mon Sep 17 00:00:00 2001 From: Shane Grant Date: Fri, 21 Feb 2014 15:52:26 -0800 Subject: [PATCH] Renaming load_and_allocate to load_and_construct Anything associated this that used the verb allocate has been replaced with construct closes #59 --- include/cereal/access.hpp | 70 ++++++++++++++-------------- include/cereal/details/traits.hpp | 44 ++++++++--------- include/cereal/types/memory.hpp | 56 +++++++++++----------- include/cereal/types/polymorphic.hpp | 14 +++--- sandbox.cpp | 14 +++--- sandbox_vs.cpp | 18 +++---- unittests.cpp | 58 +++++++++++------------ 7 files changed, 137 insertions(+), 137 deletions(-) diff --git a/include/cereal/access.hpp b/include/cereal/access.hpp index 130ea1e1..d7cc9844 100644 --- a/include/cereal/access.hpp +++ b/include/cereal/access.hpp @@ -39,11 +39,11 @@ namespace cereal { //! A class that allows cereal to load smart pointers to types that have no default constructor /*! If your class does not have a default constructor, cereal will not be able - to load any smart pointers to it unless you overload LoadAndAllocate - for your class, and provide an appropriate load_and_allocate method. You can also + to load any smart pointers to it unless you overload LoadAndConstruct + for your class, and provide an appropriate load_and_construct method. You can also choose to define a member static function instead of specializing this class. - The specialization of LoadAndAllocate must be placed within the cereal namespace: + The specialization of LoadAndConstruct must be placed within the cereal namespace: @code{.cpp} struct MyType @@ -59,20 +59,20 @@ namespace cereal } }; - // Provide a specialization for LoadAndAllocate for your type + // Provide a specialization for LoadAndConstruct for your type namespace cereal { - template <> struct LoadAndAllocate + template <> struct LoadAndConstruct { - // load_and_allocate will be passed the archive that you will be loading - // from as well as an allocate object which you can use as if it were the + // load_and_construct will be passed the archive that you will be loading + // from as well as a construct object which you can use as if it were the // constructor for your type. cereal will handle all memory management for you. template - static void load_and_allocate( Archive & ar, cereal::allocate & allocate ) + static void load_and_construct( Archive & ar, cereal::construct & construct ) { int x; ar( x ); - allocate( x ); + construct( x ); } }; } // end namespace cereal @@ -81,30 +81,30 @@ namespace cereal Please note that just as in using external serialization functions, you cannot get access to non-public members of your class by befriending cereal::access. If you have the ability to modify the class you wish to serialize, it is recommended that you - use member serialize functions and a static member load_and_allocate function. + use member serialize functions and a static member load_and_construct function. @tparam T The type to specialize for @ingroup Access */ template - struct LoadAndAllocate + struct LoadAndConstruct { - //! Called by cereal if no default constructor exists to load and allocate data simultaneously + //! Called by cereal if no default constructor exists to load and construct data simultaneously /*! Overloads of this should return a pointer to T and expect an archive as a parameter */ - static std::false_type load_and_allocate(...) + static std::false_type load_and_construct(...) { return std::false_type(); } }; - // forward decl for allocate + // forward decl for construct //! @cond PRIVATE_NEVERDEFINED - namespace memory_detail{ template struct LoadAndAllocateLoadWrapper; } + namespace memory_detail{ template struct LoadAndConstructLoadWrapper; } //! @endcond - //! Used to allocate types with no default constructor + //! Used to construct types with no default constructor /*! When serializing a type that has no default constructor, cereal - will attempt to call either the class static function load_and_allocate - or the appropriate template specialization of LoadAndAllocate. cereal + will attempt to call either the class static function load_and_construct + or the appropriate template specialization of LoadAndConstruct. cereal will pass that function a reference to the archive as well as a reference - to an allocate object which should be used to perform the allocation once + to a construct object which should be used to perform the allocation once data has been appropriately loaded. @code{.cpp} @@ -124,21 +124,21 @@ namespace cereal } template - static void load_and_allocate( Archive & ar, cereal::allocate & allocate ) + static void load_and_construct( Archive & ar, cereal::construct & construct ) { int x, y; ar( x, y ); - // use allocate object to initialize with loaded data - allocate( x, y ); + // use construct object to initialize with loaded data + construct( x, y ); // access to member variables and functions via -> operator - ar( allocate->notInConstructor ); + ar( construct->notInConstructor ); // could also do the above section by: double z; ar( z ); - allocate->notInConstructor = z; + construct->notInConstructor = z; } }; @endcode @@ -146,10 +146,10 @@ namespace cereal @tparam T The class type being serialized */ template - class allocate + class construct { public: - //! Allocate and initialize the type T with the given arguments + //! Construct and initialize the type T with the given arguments /*! This will forward all arguments to the underlying type T, calling an appropriate constructor. @@ -162,7 +162,7 @@ namespace cereal void operator()( Args && ... args ) { if( itsValid ) - throw Exception("Attempting to allocate an already initialized object"); + throw Exception("Attempting to construct an already initialized object"); new (itsPtr) T( std::forward( args )... ); itsValid = true; @@ -183,7 +183,7 @@ namespace cereal //! Returns a raw pointer to the initialized underlying object /*! This is mainly intended for use with passing an instance of - an allocated object to cereal::base_class. + a constructed object to cereal::base_class. It is strongly recommended to avoid using this function in any other circumstance. @@ -195,11 +195,11 @@ namespace cereal } private: - template friend struct ::cereal::memory_detail::LoadAndAllocateLoadWrapper; + template friend struct ::cereal::memory_detail::LoadAndConstructLoadWrapper; - allocate( T * p ) : itsPtr( p ), itsValid( false ) {} - allocate( allocate const & ) = delete; - allocate & operator=( allocate const & ) = delete; + construct( T * p ) : itsPtr( p ), itsValid( false ) {} + construct( construct const & ) = delete; + construct & operator=( construct const & ) = delete; T * itsPtr; bool itsValid; @@ -263,13 +263,13 @@ namespace cereal { t.load(ar, version); } template - static std::false_type load_and_allocate(...) + static std::false_type load_and_construct(...) { return std::false_type(); } template inline - static auto load_and_allocate(Archive & ar, ::cereal::allocate & allocate) -> decltype(T::load_and_allocate(ar, allocate)) + static auto load_and_construct(Archive & ar, ::cereal::construct & construct) -> decltype(T::load_and_construct(ar, construct)) { - T::load_and_allocate( ar, allocate ); + T::load_and_construct( ar, construct ); } }; diff --git a/include/cereal/details/traits.hpp b/include/cereal/details/traits.hpp index ec1c1984..bfea1cee 100644 --- a/include/cereal/details/traits.hpp +++ b/include/cereal/details/traits.hpp @@ -145,22 +145,22 @@ namespace cereal struct has_non_member_versioned_##name : std::integral_constant::value> {} // ###################################################################### - // Member load_and_allocate + // Member load_and_construct template - struct has_member_load_and_allocate : - std::integral_constant( std::declval(), std::declval< ::cereal::allocate&>() ) ), void>::value> {}; + struct has_member_load_and_construct : + std::integral_constant( std::declval(), std::declval< ::cereal::construct&>() ) ), void>::value> {}; // ###################################################################### - // Non Member load_and_allocate + // Non Member load_and_construct template - struct has_non_member_load_and_allocate : std::integral_constant::load_and_allocate( std::declval(), std::declval< ::cereal::allocate&>() ) ), void>::value> {}; + struct has_non_member_load_and_construct : std::integral_constant::load_and_construct( std::declval(), std::declval< ::cereal::construct&>() ) ), void>::value> {}; // ###################################################################### // Has either a member or non member allocate template - struct has_load_and_allocate : std::integral_constant::value || has_non_member_load_and_allocate::value> + struct has_load_and_construct : std::integral_constant::value || has_non_member_load_and_construct::value> { }; // ###################################################################### @@ -580,47 +580,47 @@ namespace cereal // ###################################################################### namespace detail { - template ::value, bool NonMember = traits::has_non_member_load_and_allocate::value> - struct Load + template ::value, bool NonMember = traits::has_non_member_load_and_construct::value> + struct Construct { - static_assert( !sizeof(T), "Cereal detected both member and non member load_and_allocate functions!" ); - static T * load_andor_allocate( A & /*ar*/, allocate & /*allocate*/ ) + static_assert( !sizeof(T), "Cereal detected both member and non member load_and_construct functions!" ); + static T * load_andor_construct( A & /*ar*/, construct & /*construct*/ ) { return nullptr; } }; template - struct Load + struct Construct { static_assert( std::is_default_constructible::value, "Trying to serialize a an object with no default constructor.\n\n" "Types must either be default constructible or define either a member or non member Construct function.\n" "Construct functions generally have the signature:\n\n" "template \n" - "static void load_and_allocate(Archive & ar, cereal::allocate & allocate)\n" + "static void load_and_construct(Archive & ar, cereal::construct & construct)\n" "{\n" " var a;\n" " ar( a )\n" - " allocate( a );\n" + " construct( a );\n" "}\n\n" ); - static T * load_andor_allocate() + static T * load_andor_construct() { return new T(); } }; template - struct Load + struct Construct { - static void load_andor_allocate( A & ar, allocate & allocate ) + static void load_andor_construct( A & ar, construct & construct ) { - access::load_and_allocate( ar, allocate ); + access::load_and_construct( ar, construct ); } }; template - struct Load + struct Construct { - static void load_andor_allocate( A & ar, allocate & allocate ) + static void load_andor_construct( A & ar, construct & construct ) { - LoadAndAllocate::load_and_allocate( ar, allocate ); + LoadAndConstruct::load_and_construct( ar, construct ); } }; } // namespace detail diff --git a/include/cereal/types/memory.hpp b/include/cereal/types/memory.hpp index 6f2c5647..8560218f 100644 --- a/include/cereal/types/memory.hpp +++ b/include/cereal/types/memory.hpp @@ -56,26 +56,26 @@ namespace cereal return {std::forward(t)}; } - //! A struct that acts as a wrapper around calling load_andor_allocate - /*! The purpose of this is to allow a load_and_allocate call to properly enter into the + //! A struct that acts as a wrapper around calling load_andor_construct + /*! The purpose of this is to allow a load_and_construct call to properly enter into the 'data' NVP of the ptr_wrapper @internal */ template - struct LoadAndAllocateLoadWrapper + struct LoadAndConstructLoadWrapper { - LoadAndAllocateLoadWrapper( T * ptr ) : - allocate( ptr ) + LoadAndConstructLoadWrapper( T * ptr ) : + construct( ptr ) { } inline void serialize( Archive & ar ) { - ::cereal::detail::Load::load_andor_allocate( ar, allocate ); + ::cereal::detail::Construct::load_andor_construct( ar, construct ); } - ::cereal::allocate allocate; + ::cereal::construct construct; }; - //! Performs loading and allocation for a shared pointer that is NOT derived from + //! Performs loading and construction for a shared pointer that is NOT derived from //! std::enable_shared_from_this /*! This is the typical case, where we simply pass the load wrapper to the archive @@ -84,15 +84,15 @@ namespace cereal @param ptr Raw pointer held by the shared_ptr @internal */ template inline - void loadAndAllocateSharedPtr( Archive & ar, T * ptr, std::false_type /* has_shared_from_this */ ) + void loadAndConstructSharedPtr( Archive & ar, T * ptr, std::false_type /* has_shared_from_this */ ) { - memory_detail::LoadAndAllocateLoadWrapper loadWrapper( ptr ); + memory_detail::LoadAndConstructLoadWrapper loadWrapper( ptr ); ar( _CEREAL_NVP("data", loadWrapper) ); } - //! Performs loading and allocation for a shared pointer that is derived from + //! Performs loading and construction for a shared pointer that is derived from //! std::enable_shared_from_this - /*! This special case is necessary because when a user uses load_and_allocate, + /*! This special case is necessary because when a user uses load_and_construct, the weak_ptr (or whatever implementation defined variant) that allows enable_shared_from_this to function correctly will not be initialized properly. @@ -110,9 +110,9 @@ namespace cereal @param ptr Raw pointer held by the shared_ptr @internal */ template inline - void loadAndAllocateSharedPtr( Archive & ar, T * ptr, std::true_type /* has_shared_from_this */ ) + void loadAndConstructSharedPtr( Archive & ar, T * ptr, std::true_type /* has_shared_from_this */ ) { - memory_detail::LoadAndAllocateLoadWrapper loadWrapper( ptr ); + memory_detail::LoadAndConstructLoadWrapper loadWrapper( ptr ); // typedefs for parent type and storage type using BaseType = typename ::cereal::traits::get_shared_from_this_base::type; @@ -143,7 +143,7 @@ namespace cereal ar( _CEREAL_NVP("ptr_wrapper", memory_detail::make_ptr_wrapper( ptr )) ); } - //! Loading std::shared_ptr, case when no user load and allocate for non polymorphic types + //! Loading std::shared_ptr, case when no user load and construct for non polymorphic types template inline typename std::enable_if::value, void>::type load( Archive & ar, std::shared_ptr & ptr ) @@ -178,7 +178,7 @@ namespace cereal ar( _CEREAL_NVP("ptr_wrapper", memory_detail::make_ptr_wrapper( ptr )) ); } - //! Loading std::unique_ptr, case when user provides load_and_allocate for non polymorphic types + //! Loading std::unique_ptr, case when user provides load_and_construct for non polymorphic types template inline typename std::enable_if::value, void>::type load( Archive & ar, std::unique_ptr & ptr ) @@ -205,10 +205,10 @@ namespace cereal } } - //! Loading std::shared_ptr, case when user load and allocate (wrapper implementation) + //! Loading std::shared_ptr, case when user load and construct (wrapper implementation) /*! @internal */ template inline - typename std::enable_if::value, void>::type + typename std::enable_if::value, void>::type load( Archive & ar, memory_detail::PtrWrapper &> & wrapper ) { auto & ptr = wrapper.ptr; @@ -243,7 +243,7 @@ namespace cereal ar.registerSharedPointer( id, ptr ); // Perform the actual loading and allocation - memory_detail::loadAndAllocateSharedPtr( ar, ptr.get(), typename ::cereal::traits::has_shared_from_this::type() ); + memory_detail::loadAndConstructSharedPtr( ar, ptr.get(), typename ::cereal::traits::has_shared_from_this::type() ); // Mark pointer as valid (initialized) *valid = true; @@ -252,10 +252,10 @@ namespace cereal ptr = std::static_pointer_cast(ar.getSharedPointer(id)); } - //! Loading std::shared_ptr, case when no user load and allocate (wrapper implementation) + //! Loading std::shared_ptr, case when no user load and construct (wrapper implementation) /*! @internal */ template inline - typename std::enable_if::value, void>::type + typename std::enable_if::value, void>::type load( Archive & ar, memory_detail::PtrWrapper &> & wrapper ) { auto & ptr = wrapper.ptr; @@ -266,7 +266,7 @@ namespace cereal if( id & detail::msb_32bit ) { - ptr.reset( detail::Load::load_andor_allocate() ); + ptr.reset( detail::Construct::load_andor_construct() ); ar.registerSharedPointer( id, ptr ); ar( _CEREAL_NVP("data", *ptr) ); } @@ -294,10 +294,10 @@ namespace cereal } } - //! Loading std::unique_ptr, case when user provides load_and_allocate (wrapper implementation) + //! Loading std::unique_ptr, case when user provides load_and_construct (wrapper implementation) /*! @internal */ template inline - typename std::enable_if::value, void>::type + typename std::enable_if::value, void>::type load( Archive & ar, memory_detail::PtrWrapper &> & wrapper ) { uint8_t isValid; @@ -316,7 +316,7 @@ namespace cereal std::unique_ptr stPtr( new ST() ); // Use wrapper to enter into "data" nvp of ptr_wrapper - memory_detail::LoadAndAllocateLoadWrapper loadWrapper( reinterpret_cast( stPtr.get() ) ); + memory_detail::LoadAndConstructLoadWrapper loadWrapper( reinterpret_cast( stPtr.get() ) ); // Initialize storage ar( _CEREAL_NVP("data", loadWrapper) ); @@ -328,10 +328,10 @@ namespace cereal ptr.reset( nullptr ); } - //! Loading std::unique_ptr, case when no load_and_allocate (wrapper implementation) + //! Loading std::unique_ptr, case when no load_and_construct (wrapper implementation) /*! @internal */ template inline - typename std::enable_if::value, void>::type + typename std::enable_if::value, void>::type load( Archive & ar, memory_detail::PtrWrapper &> & wrapper ) { uint8_t isValid; @@ -341,7 +341,7 @@ namespace cereal if( isValid ) { - ptr.reset( detail::Load::load_andor_allocate() ); + ptr.reset( detail::Construct::load_andor_construct() ); ar( *ptr ); } else diff --git a/include/cereal/types/polymorphic.hpp b/include/cereal/types/polymorphic.hpp index a083e2dc..dfa579c2 100644 --- a/include/cereal/types/polymorphic.hpp +++ b/include/cereal/types/polymorphic.hpp @@ -133,7 +133,7 @@ namespace cereal @internal */ template inline typename std::enable_if<(std::is_default_constructible::value - || traits::has_load_and_allocate::value) + || traits::has_load_and_construct::value) && !std::is_abstract::value, bool>::type serialize_wrapper(Archive & ar, std::shared_ptr & ptr, std::uint32_t const nameid) { @@ -151,7 +151,7 @@ namespace cereal @internal */ template inline typename std::enable_if<(std::is_default_constructible::value - || traits::has_load_and_allocate::value) + || traits::has_load_and_construct::value) && !std::is_abstract::value, bool>::type serialize_wrapper(Archive & ar, std::unique_ptr & ptr, std::uint32_t const nameid) { @@ -171,12 +171,12 @@ namespace cereal @internal */ template inline typename std::enable_if<(!std::is_default_constructible::value - && !traits::has_load_and_allocate::value) + && !traits::has_load_and_construct::value) || std::is_abstract::value, bool>::type serialize_wrapper(Archive &, std::shared_ptr &, std::uint32_t const nameid) { if(nameid & detail::msb2_32bit) - throw cereal::Exception("Cannot load a polymorphic type that is not default constructable and does not have a load_and_allocate function"); + throw cereal::Exception("Cannot load a polymorphic type that is not default constructable and does not have a load_and_construct function"); return false; } @@ -188,12 +188,12 @@ namespace cereal @internal */ template inline typename std::enable_if<(!std::is_default_constructible::value - && !traits::has_load_and_allocate::value) + && !traits::has_load_and_construct::value) || std::is_abstract::value, bool>::type serialize_wrapper(Archive &, std::unique_ptr &, std::uint32_t const nameid) { if(nameid & detail::msb2_32bit) - throw cereal::Exception("Cannot load a polymorphic type that is not default constructable and does not have a load_and_allocate function"); + throw cereal::Exception("Cannot load a polymorphic type that is not default constructable and does not have a load_and_construct function"); return false; } } // polymorphic_detail @@ -360,7 +360,7 @@ namespace cereal binding->second.unique_ptr(&ar, ptr.get()); } - //! Loading std::unique_ptr, case when user provides load_and_allocate for polymorphic types + //! Loading std::unique_ptr, case when user provides load_and_construct for polymorphic types template inline typename std::enable_if::value, void>::type load( Archive & ar, std::unique_ptr & ptr ) diff --git a/sandbox.cpp b/sandbox.cpp index 768add07..fce98284 100644 --- a/sandbox.cpp +++ b/sandbox.cpp @@ -261,27 +261,27 @@ public: } template - static void load_and_allocate( Archive & ar, cereal::allocate & allocate ) + static void load_and_construct( Archive & ar, cereal::construct & construct ) { int y; ar( y ); - allocate( y ); - allocate->z = 33; - allocate.ptr()->z = 33; + construct( y ); + construct->z = 33; + construct.ptr()->z = 33; } }; //namespace cereal //{ // template <> -// struct LoadAndAllocate +// struct LoadAndConstruct // { // template -// static void load_and_allocate( Archive & ar, cereal::allocate & allocate ) +// static void load_and_construct( Archive & ar, cereal::construct & construct ) // { // int y; // ar( y ); -// allocate( y ); +// construct( y ); // } // }; //} diff --git a/sandbox_vs.cpp b/sandbox_vs.cpp index c9ce2e9f..39d6cb09 100644 --- a/sandbox_vs.cpp +++ b/sandbox_vs.cpp @@ -63,7 +63,7 @@ struct Test } template - static Test * load_and_allocate( Archive & ) + static Test * load_and_construct( Archive & ) { return new Test(); } @@ -84,12 +84,12 @@ void save( Archive &, Test const & ) namespace cereal { template <> - struct LoadAndAllocate + struct LoadAndConstruct { template - static void load_and_allocate( Archive &, cereal::allocate & allocate ) + static void load_and_construct( Archive &, cereal::construct & construct ) { - allocate(); + construct(); } }; } @@ -130,10 +130,10 @@ int main() typedef Test T; std::cout << std::boolalpha; - // Test Load and Allocate internal/external - std::cout << "\tload_and_allocate" << std::endl; - std::cout << cereal::traits::has_member_load_and_allocate::value << std::endl; - std::cout << cereal::traits::has_non_member_load_and_allocate::value << std::endl; + // Test Load and Construct internal/external + std::cout << "\tload_and_construct" << std::endl; + std::cout << cereal::traits::has_member_load_and_construct::value << std::endl; + std::cout << cereal::traits::has_non_member_load_and_construct::value << std::endl; // serialize std::cout << "\tserialize" << std::endl; @@ -172,7 +172,7 @@ int main() // array size std::cout << typeid(A).name() << std::endl; - std::cout << typeid(cereal::traits::has_load_and_allocate).name() << std::endl; + std::cout << typeid(cereal::traits::has_load_and_construct).name() << std::endl; // extra testing diff --git a/unittests.cpp b/unittests.cpp index 0999bb44..468a8e1a 100644 --- a/unittests.cpp +++ b/unittests.cpp @@ -1042,20 +1042,20 @@ std::ostream& operator<<(std::ostream& os, MemoryCycle const & s) return os; } -class MemoryCycleLoadAndAllocate +class MemoryCycleLoadAndConstruct { public: - MemoryCycleLoadAndAllocate( int v ) : + MemoryCycleLoadAndConstruct( int v ) : value( v ) { } - MemoryCycleLoadAndAllocate( int v, - std::weak_ptr p ) : + MemoryCycleLoadAndConstruct( int v, + std::weak_ptr p ) : value( v ), ptr( p ) { } - bool operator==( MemoryCycleLoadAndAllocate const & other ) const + bool operator==( MemoryCycleLoadAndConstruct const & other ) const { return value == other.value && ptr.lock() == other.ptr.lock(); } @@ -1067,20 +1067,20 @@ class MemoryCycleLoadAndAllocate } template - static void load_and_allocate( Archive & ar, cereal::allocate & allocate ) + static void load_and_construct( Archive & ar, cereal::construct & construct ) { int value; - std::weak_ptr ptr; + std::weak_ptr ptr; ar( value, ptr ); - allocate( value, ptr ); + construct( value, ptr ); } int value; - std::weak_ptr ptr; + std::weak_ptr ptr; }; -std::ostream& operator<<(std::ostream& os, MemoryCycleLoadAndAllocate const & s) +std::ostream& operator<<(std::ostream& os, MemoryCycleLoadAndConstruct const & s) { os << "[value: " << s.value << " ptr: " << s.ptr.lock() << "]"; return os; @@ -1096,7 +1096,7 @@ void test_memory_cycles() { auto o_ptr1 = std::make_shared( random_value(gen) ); o_ptr1->ptr = o_ptr1; - auto o_ptr2 = std::make_shared( random_value(gen) ); + auto o_ptr2 = std::make_shared( random_value(gen) ); o_ptr2->ptr = o_ptr2; std::ostringstream os; @@ -1157,11 +1157,11 @@ struct OneLA { ar( x ); } template - static void load_and_allocate( Archive & ar, cereal::allocate & allocate ) + static void load_and_construct( Archive & ar, cereal::construct & construct ) { int xx; ar( xx ); - allocate( xx ); + construct( xx ); } bool operator==( OneLA const & other ) const @@ -1197,14 +1197,14 @@ std::ostream& operator<<(std::ostream& os, TwoLA const & s) namespace cereal { template <> - struct LoadAndAllocate + struct LoadAndConstruct { template - static void load_and_allocate( Archive & ar, cereal::allocate & allocate ) + static void load_and_construct( Archive & ar, cereal::construct & construct ) { int xx; ar( xx ); - allocate( xx ); + construct( xx ); } }; } @@ -1223,11 +1223,11 @@ struct ThreeLA : std::enable_shared_from_this { return x == other.x; } template - static void load_and_allocate( Archive & ar, cereal::allocate & allocate ) + static void load_and_construct( Archive & ar, cereal::construct & construct ) { int xx; ar( xx ); - allocate( xx ); + construct( xx ); } }; @@ -1238,7 +1238,7 @@ std::ostream& operator<<(std::ostream& os, ThreeLA const & s) } template -void test_memory_load_allocate() +void test_memory_load_construct() { std::random_device rd; std::mt19937 gen(rd()); @@ -1290,24 +1290,24 @@ void test_memory_load_allocate() } } -BOOST_AUTO_TEST_CASE( binary_memory_load_allocate ) +BOOST_AUTO_TEST_CASE( binary_memory_load_construct ) { - test_memory_load_allocate(); + test_memory_load_construct(); } -BOOST_AUTO_TEST_CASE( portable_binary_memory_load_allocate ) +BOOST_AUTO_TEST_CASE( portable_binary_memory_load_construct ) { - test_memory_load_allocate(); + test_memory_load_construct(); } -BOOST_AUTO_TEST_CASE( xml_memory_load_allocate ) +BOOST_AUTO_TEST_CASE( xml_memory_load_construct ) { - test_memory_load_allocate(); + test_memory_load_construct(); } -BOOST_AUTO_TEST_CASE( json_memory_load_allocate ) +BOOST_AUTO_TEST_CASE( json_memory_load_construct ) { - test_memory_load_allocate(); + test_memory_load_construct(); } // ###################################################################### @@ -3152,11 +3152,11 @@ struct PolyDerivedLA : public PolyLA } template - static void load_and_allocate( Archive & ar, cereal::allocate & allocate ) + static void load_and_construct( Archive & ar, cereal::construct & construct ) { int xx; ar( xx ); - allocate( xx ); + construct( xx ); } void foo() {}