typedef boost::shared_ptr<MyJob> Ptr; or #define Ptr boost::shared_ptr
- by danio
I've just started wrking on a new codebase where each class contains a shared_ptr typedef (similar to this) like:
typedef boost::shared_ptr<MyClass> Ptr;
Is the only purpose to save typing boost::shared_ptr?
If that is the case why not do
#define Ptr boost::shared_ptr
in one common header? Then you can do:
Ptr<MyClass> myClass(new MyClass);
which is no more typing than
MyClass::Ptr myClass(new MyClass);
and saves the Ptr definition in each class.