|
#include <smart_ptr.hpp>
struct ShapeWithStaticCloneLogic { ShapeWithStaticCloneLogic(){} ~ShapeWithStaticCloneLogic(){} ShapeWithStaticCloneLogic(const ShapeWithStaticCloneLogic& src){} virtual std::string GetTypeName()const = 0; }; struct CircleWithStaticCloneLogic : public ShapeWithStaticCloneLogic { CircleWithStaticCloneLogic(){} ~CircleWithStaticCloneLogic(){} CircleWithStaticCloneLogic(const CircleWithStaticCloneLogic& src){} std::string GetTypeName()const{return "Circle";} inline static CircleWithStaticCloneLogic* do_clone(const CircleWithStaticCloneLogic& Src){return new CircleWithStaticCloneLogic(Src);} }; void example_clone_static_function_allocator_policy_usage() { smart_ptr<ShapeWithStaticCloneLogic, ownership_default_policy, clone_static_function_allocator_policy> vShape1(new CircleWithStaticCloneLogic); smart_ptr<ShapeWithStaticCloneLogic, ownership_default_policy, clone_static_function_allocator_policy> vShape2(vShape1); std::cout << vShape2->GetTypeName() << std::cout; }
Definition at line 208 of file smart_ptr.hpp.
Static Public Member Functions | |
template<typename T_obj> | |
static T_obj * | allocate (const T_obj *ptr) |
allocate clones the input argument by calling static function do_clone. | |
template<typename T_obj> | |
static void | deallocate (T_obj *ptr) |
|
allocate clones the input argument by calling static function do_clone.
Definition at line 216 of file smart_ptr.hpp. |
|
Definition at line 224 of file smart_ptr.hpp. |