I have a school assignment where I have to code a template class that would store the minimum of a list of ints. When running it, I get parse errors but I don't understand why. Could someone explain why I'm getting these errors?
ListMin.hpp
template <int ... list>
class ListMin;
template <int first, int ... others>
class ListMin <first, others ...> {
public:
enum : long { value = std::min(first, ListMin<others>::value) };
};
template <int first>
class ListMin <first> {
public:
enum : long { value = first };
};
Main.cpp
std::cout << "min( [ 1, -5, 3 ] ) = " << ListMin< 1, -5, 3 >::value << std::endl;
The errors
ListMin.hpp:4: parse error before `...'
ListMin.hpp:7: parse error before `...'
ListMin.hpp:14: parse error before `<'
Thanks in advance