|
Boost : |
From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-11-09 20:07:08
On Saturday 09 November 2002 07:21 pm, Aleksey Gurtovoy wrote:
[snip some code...]
> template< typename T > yes_tag is_callable_helper(
> sink< sizeof(&T::operator()) >*
> );
[snip more code...]
Won't work if there are multiple overloads of operator() or if it is a
function template, unfortunately :(
> But of course none of the compilers are particularly happy about it. How
> about adding 'is_callable<>' to the type_traits proposal and requesting a
> compiler support for it?
We could, but I have a hunch that we wouldn't get it. The is_callable trait
takes a lot of specification and only handles very specific cases. If we're
going to ask for something like is_callable, we're better off asking for
something that handles more cases (i.e., "is this expression valid?" or "can
I instantiate this class template?").
Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk