As a part of my custom object system I would like to have a Container class that just wraps a third party object so that they can be integrated into my container system.
Assuming I have the following third party object,
class Point {
public:
int x;
Point(int y = 0) : x(y) {}
int value() { return x; }
};
Container class,
template <typename T, typename... Args> class Value{
T dat;
public:
Container(const Args &... args) { dat = T(args...); }
T data() { return dat; }
};
I am trying to provide the following api,
Value<Point> v = Value<Point>(1);
I am trying to pass the parameters passed to the value constructor directly to type T constructor.
Aucun commentaire:
Enregistrer un commentaire