policy base class using static member functions

Discussion in 'C++' started by Axter, Jan 19, 2006.

  1. Axter

    Axter Guest

    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?
     
    Axter, Jan 19, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. yan
    Replies:
    1
    Views:
    465
    Victor Bazarov
    Feb 11, 2004
  2. Siemel Naran
    Replies:
    4
    Views:
    816
    Micah Cowan
    Jan 12, 2005
  3. Axter
    Replies:
    0
    Views:
    334
    Axter
    Jan 19, 2006
  4. dolphin
    Replies:
    3
    Views:
    1,362
    Pete Becker
    Dec 5, 2007
  5. paul
    Replies:
    8
    Views:
    727
    Alf P. Steinbach
    Apr 30, 2009
Loading...

Share This Page