How to make the statement shorter:
auto ptr = std::shared_ptr<CPoint>(new CPoint(x, y));
Please notice the CPoint
appears twice. Can it be shorter?
like:
auto ptr = XXXX<CPoint>(x, y);
XXXX
is a macro or anything. It should apply to any constructor with any parameters.
auto ptrA = XXXX<ClassA>(); // a shared_ptr to new ClassA()
auto ptrB = XXXX<ClassB>(a, b, c); // a shared_ptr to new ClassB(a, b, c)
Aucun commentaire:
Enregistrer un commentaire