Boost logo

Boost Users :

From: John (john_at_[hidden])
Date: 2008-06-24 09:43:08


This pattern/idiom is well-established:

   struct A {
       virtual A* clone () = 0;
   };

   struct B : public A {
       virtual B* clone ();
   };

But the above does not work when the pointers A* and B* are replaced by
shared_ptr<A> and shared_ptr<B>:

   struct A {
      virtual shared_ptr<A> clone () = 0;
   };

   struct B : public A {
      virtual shared_ptr<B> clone ();
   };

Is there a workaround? Another way to solve the same problem? Thanks!

-John


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net