I created this struct
for some easy templated Math definitions:
template<class T = float> struct Math{
static constexpr T PI = T(3.14159265359);
static constexpr T E = T(2.718281828459);
static constexpr T INF = std::numeric_limits<T>::infinity();
};
I would like to use it like this:
float pi = Math::PI;
Even if the default argument T
is float
Ill get the error:
'template<class T> struct Math' used without template parameters
If I use Math<>::PI
it works. Is this a compiler bug or are the <>
brackets mandatory?
Aucun commentaire:
Enregistrer un commentaire