In our large project we have a lot class with the following typedef
's:
class Foo
{
public:
typedef std::auto_ptr<Foo> Ptr;
typedef boost::shared_ptr<Foo> Ref;
...
};
...
Foo::Ref foo(new Foo);
...
doBar(foo);
...
The using of them is very convenient. But I doubt if auto_ptr
is semantically close to Ptr
and shared_ptr
is the same as ref? Or should auto_ptr
be used explicitly since it has "ownership transfer" semantics?
Thanks,