This question already has an answer here:
I'm making a class that makes use of a C-array of type, which is of size D, with mathematicals operations.
The class can be summed as follows :
template <typename T, unsigned char D>
class point
{
private:
T p [D];
public:
typedef T value_type;
static const unsigned char dimension = D;
point (const T...); //Here I put variadic argument but it wont do.
};
I would like to enforce the user to use either 0 parameters (point()) or D (point(2.f,5.f)).
So that's my question : Is there a way to force the user at compile-time to declare as much parameters as he asked for ? And is it possible to enable him to use the same constructor as a default constructor ?
Thank you for reading.
Aucun commentaire:
Enregistrer un commentaire