mardi 2 avril 2019

How to write "nested if...else statement for constants" without warnings, in gnu++11 standard?

When I use nested if....else statement with

if (std::is_same<T, int>::value) 
{
  // do something
} 
else if (std::is_same<T, float>::value)
{
  // do something else
}
.
.
.
else
{
  // print error
}

I get a QACPP static code analyzer's compiler warning qacpp-4.2.1-4090 with message "The condition in this 'if' statement is constant." How do I fix this compiler warning in gnu++11 standards ?

NOTE: I'm not an expert at C++ so please excuse me if the question sounds amateur.

Aucun commentaire:

Enregistrer un commentaire