A
Axter
I'm currently working on the following policy base smart pointer:
http://code.axter.com/smart_ptr.h
Before working on the above code, I read the following links:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1681.pdf
http://www.cuj.com/documents/s=8890/cujexp0310alexandr/alexandr.htm
I notice the above links only talk about using policy base logic via
direct inheritance and multiple inheritance.
In the smart_ptr class I used a static member function interface to
pull in the policy logic.
This allows me to declare a smart pointer like this:
smart_ptr<Shape, deep_copy_policy, clone_function_allocator_policy>
pShape;
Instead of like this:
smart_ptr<Shape, deep_copy_policy<Shape> ,
clone_function_allocator_policy<Shape> > pShape;
or worse:
smart_ptr<Shape, deep_copy_policy<Shape,
clone_function_allocator_policy<Shape> > > pShape;
Can any one see anything wrong with using the static member function
method, or any pros to using inheritance method that I would loose by
using static member function method?
http://code.axter.com/smart_ptr.h
Before working on the above code, I read the following links:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1681.pdf
http://www.cuj.com/documents/s=8890/cujexp0310alexandr/alexandr.htm
I notice the above links only talk about using policy base logic via
direct inheritance and multiple inheritance.
In the smart_ptr class I used a static member function interface to
pull in the policy logic.
This allows me to declare a smart pointer like this:
smart_ptr<Shape, deep_copy_policy, clone_function_allocator_policy>
pShape;
Instead of like this:
smart_ptr<Shape, deep_copy_policy<Shape> ,
clone_function_allocator_policy<Shape> > pShape;
or worse:
smart_ptr<Shape, deep_copy_policy<Shape,
clone_function_allocator_policy<Shape> > > pShape;
Can any one see anything wrong with using the static member function
method, or any pros to using inheritance method that I would loose by
using static member function method?