typedef boost::shared_ptr<MyJob> Ptr; or #define Ptr boost::shared_ptr
Posted
by danio
on Stack Overflow
See other posts from Stack Overflow
or by danio
Published on 2010-06-16T10:54:49Z
Indexed on
2010/06/16
11:02 UTC
Read the original article
Hit count: 268
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.
© Stack Overflow or respective owner