I have a constructor with the following form:
foo(const barClass &baz) : qux(baz) {
// stuff
}
The compiler doesn't like that, because qux wants a const, so the compiler complains about dropping qualifiers. No problem, I add a const_cast.
foo(const barClass &baz) : qux(const_castbaz) {
// stuff
}
The compiler is happy, unittests pass. Everything's good, except Sonarqube. Sonarqube does not like const_cast'ing a non const.
I'm not sure how to navigate this, other than getting rid of the barClass member and breaking it up into variables (the class is basically just a struct). Is there a way to do this that makes everyone happy?