I'm asking for a discussion of the circumstances in which, in C++, declaring the parameter of a function as const
will actually improve the generated code (rather than improving the source code, where appropriate const
unambiguously adds value).
The initial motivation was code like the following lacking the const
:
#include <vector>
class foo {
public:
foo(const std::vector<int> bar); // construct foo from vector of int
/*...*/
};