I\'m flip-flopping between naming conventions for typedef\'ing the boost::shared_ptr template. For example:
typedef boost::shared_ptr FooPtr;
class foo;
typedef boost::shared_ptr<foo> foo_p;
typedef boost::weak_ptr<foo> foo_wp;
typedef boost::shared_ptr<MyClass> MyClass$;
My preference:
class Foo
{
public:
typedef boost::shared_ptr<Foo> SharedPointer;
};
The problem with just FooPtr
is that you may have different types of pointers (e.g., weak_ptr
s). I also don't much care for abbreviations, but that's another matter altogether.
I would get rid of the namespace instead of shortening the type.
using boost::shared_ptr; // or using std::shared_ptr,
struct Foo
{
shared_ptr<Foo> impl;
};
Which has the bonus that you can change between implementations easily.
If that is still too long (I think it is just right):
using boost::shared_ptr;
template<class T> using sptr = shared_ptr<T>;
struct Foo
{
sptr<Foo> impl;
};