mercredi 28 octobre 2015

make_shared as extern template

It is possible to use extern template to be able to call make_shared on a forward defined type?

class Point;
shared_ptr<Point> create();

void readPoint()
{
   shared_ptr<Point> = create();
   ....
}

So in above code I declare create to be able to use it in readPoint when Point is not yet fully defined, create implementation is just a call to make_shared<Point>(), I wondering if extern template can be used here to avoid the need of create method being defined.

Aucun commentaire:

Enregistrer un commentaire