On Monday, August 27, 2012 11:38:52 Manu wrote: > On 27 August 2012 11:12, Jonathan M Davis <jmdavisp...@gmx.com> wrote: > > and it makes no sense to use them with function pointers or function > > literals. > > If that were true, we wouldn't be having this discussion.
You can't possibly really be using these functions with default arguments unless you're not really using them like function pointers, otherwise you wouldn't have been using the default arguments in the first place. Sure, you could have something like auto func = (string a = "hello") { return a; } and then call it with one argument or no argument, but that's only because the function is completely local, and you could just as easily do string func(string a = "hello") { return a; } and get the same thing. As soon as you've really used it as a function pointer rather than a local function, you've lost the default argument. Default arguments just do not make sense with function pointers, because they don't follow the function pointer, because it's a _pointer_ and has no knowledge of what it's pointing to. It's only at the declaration point of the function that the default argument exists, and that has _nothing_ to do with the function pointer. You might as well ask a reference of type Object what the arguments used to construct the derived class that it actually refers to were as expect a function pointer to have any clue about default arguments to the function that it points to. - Jonathan M Davis