Boost logo

Boost :

Subject: [boost] [proto][can_be_called]
From: Andy Venikov (avenikov_at_[hidden])
Date: 2010-05-06 13:43:07


Currently,
can_be_called<> expects only functors.

Is it possible to extend it so that it can take any type and return true
if that type can be called with the list of given parameters.

For example,

function<int (int, char, long)> functor;
int f(int, char, long);
int dummyInt;

int main(int argc, char ** argv)
{
     assert(false == test(functor, argc, 11, argv));
     assert(true == test(functor, 10, 11, 12));

     assert(true == test(f, 10, 11, 12));
     assert(false == test(dummyInt, 1));
}

Thanks,
     Andy.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk