I would like to create a template, where i can use different vector types, and a constant as the same type of the vector. I would like to able to pass the constant as template parameter in order to let the compiler optimize it, without explicit specialization.
So i tried to re-use the type parameter, but i got illegal type.
#include <vector>
using namespace std;
template<typename WEIGHT, WEIGHT multiplier>
void test_multipier(vector<WEIGHT> &v)
{
uint16_t num = 16;
/*...*/
WEIGHT w = multiplier* (num);
v.push_back(w);
}
int main()
{
vector<double> test_vector;
test_multipier<double,0.01>(test_vector);
//^^ Error C2993 'double': illegal type for non-type template parameter 'multiplier'
return 0;
}