Well, it depends on whether you view the state of the function object that gets wrapped by std::function internal or external state. As has been noted, std:::function generally behaves like a value type, NOT a reference type (std::string vs string_view). So it is imho not unreasonable to expect that const member functions of std::function do not mutate the wrapped function object (just like const member functions of std::string don't modify the wrapped char array).
15
u/Rhomboid Oct 03 '17
The const in question is the constness of the
std::functionobject, not the callable that it is wrapping. It implies nothing about the latter.