
26 Mar
2013
26 Mar
'13
1:27 a.m.
2013/3/26 Jeffrey Lee Hellrung, Jr.
On Mon, Mar 25, 2013 at 12:22 PM, Nevin Liber
wrote: On 22 March 2013 08:15, TONGARI
wrote: It doesn't seem to work with default arguments. :-(
Here is my test case (under gcc 4.7.2 -std=c++0x):
#include "boost/type_traits/has_call.hpp" #include <cassert>
template
bool HasCall(F const&) { return boost::has_call ::value; } void DefaultVal(int = 0) {}
int main() { assert(HasCall
(DefaultVal)); } That's because the type of DefaultVal is void ( int ). Function types cannot encode the default'ness of parameters.
Yes. Instead, the following works:
struct F
{
void operator()(int = 0){}
};
...
assert(HasCall