On Wed, Sep 25, 2013 at 12:48 PM, Rob Stewart
On Sep 25, 2013, at 2:57 AM, Krzysztof Czainski <1czajnik@gmail.com> wrote:
2013/9/25 Mostafa
Both the type_traits and function_types library discard parameter const-qualifiers when decomposing function types. Is this a bug or a feature? If a feature, then it's surprising enough behaviour that I think it warrants some documentation in both libraries.
[snip]
typedef void (foo)(int const);
The two function declarations: void f(int); void f(int const); declare the same function, not an overload.
Right. Top level const is not part of the function's type.
Const added to an argument type passed by value doesn't change the function signature. It is because the parameter will be copied anyway, and the const refers to how the argument will be treated inside the function's implementation.
Exactly.