I'm trying to write something like this :
template <typename type,int p,int q = 1> struct const4array
{
static const type value [] = { type(p)/type(q) , type(p)/type(q) , type(p)/type(q) , type(1) } ;
};
double xx [] = { 0.5 , 0.5 , 0.5 , 1 } ;
double yy [] = const4array<double,1,2>::value ; // I would like to have : xx == yy
I think this code is easy to understand for a human developer, but apparently not for the compiler (it returns many errors).
Is it possible to do what I want, and if it is, how to do it properly? (I found many other questions that looks like this one, but not close enough to match mine).
Thanks in advance!
double zz[] = xx;doesn't work as well. I tried on godbolt