13-01-2022, 11:09 AM
We're not sure what the problem is that you are concerned about.
If you have class A with void run() const; and class B with void run(); and the two versions of run satisfy 9-3-3 (i.e. A::run() can be const, but B::run() can't be const), then you can instantiate foo with both A and B.
We can see that you may get a violation of 7-1-2 (make reference parameters const where possibly), but that can be avoided by overloading foo with void foo(const FooT& f)
Please clarify the concern
If you have class A with void run() const; and class B with void run(); and the two versions of run satisfy 9-3-3 (i.e. A::run() can be const, but B::run() can't be const), then you can instantiate foo with both A and B.
We can see that you may get a violation of 7-1-2 (make reference parameters const where possibly), but that can be avoided by overloading foo with void foo(const FooT& f)
Please clarify the concern
Posted by and on behalf of
the MISRA C++ Working Group
the MISRA C++ Working Group