samedi 4 février 2017

Template argument specialization example from cpprefference.com doesn't work

I found this example on http://ift.tt/1x8CP4i

template <int I, int J, int K> struct B {};
template <int I> struct B<I, I*2, 2> {};  // OK: first parameter is deducible

I have errors while compiling it whith -std=c++11 and -std=c++14

How to compile this? Or maybe example is wrong?

error: template argument ‘(I * 2)’ involves template parameter(s)
 template <int I> struct B<I, I*2, 2> {};  // OK: first parameter is deducible

Aucun commentaire:

Enregistrer un commentaire