Boost logo

Boost Users :

Subject: [Boost-users] shared_ptr on template class
From: Gao, Yi (gaoyi.cn_at_[hidden])
Date: 2009-08-19 11:10:21


Hi All,

//////In short:
If I have a templated class A<T>, within it, I want to typedef
shared_ptr to it self, should I write:
typedef shared_ptr< A<T> > PointerType;
or
typedef shared_ptr< A > PointerType;
?

//////In more detail

I have:
template< typename T>
class A
{
  public:
    typedef shared_ptr< A<T> > PointerType;
    // or
    typedef shared_ptr< A > PointerType;

    // Further more
    static PointerType New()
    {
        return PointerType(new A<T>);
        // or
        return PointerType(new A);
    }
};

Could I know if there's difference in between?

Thanks!

Yi Gao


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