Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

template fails to compile: 'double' is not a valid type for a template constant parameter

Tags:

c++

templates

template<typename T, T Min>
class LowerBoundedType {};
template<typename T> class vectorelement {};
template<> class vectorelement<Categorical> { typedef LowerBoundedType<double, 0.0> type; };

with error:

 error: 'double' is not a valid type for a template constant parameter
like image 351
Neil G Avatar asked Jun 24 '10 00:06

Neil G


1 Answers

The only numeric types valid for a nontype template parameter are integers and enumerations. So, you can't have a nontype template parameter of type double.

like image 182
James McNellis Avatar answered Sep 21 '22 16:09

James McNellis