aCuria
aCuria

Reputation: 7205

Is it possible to have a templated type not known at compile time

Suppose I have a class:

template <unsigned M, unsigned N, typename T = float>
class Matrix
{};

I want to read from a file which contains matrices of some unknown M,N and create the above type:

Matrix getMatrixFromFile(std::string &path);

Is this possible given that M, N are not known at compile time?

Upvotes: 0

Views: 137

Answers (1)

emartel
emartel

Reputation: 7773

The answer is no.

The templates parameters are used to create types at compile time based on the types passed.

Upvotes: 3

Related Questions