Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-11-10 09:15:07


On Saturday 09 November 2002 11:45 pm, Aleksey Gurtovoy wrote:
> template< typename T >
> struct is_default_constructible
>
> : mpl::bool_c<__is_well_formed(T())>
>
> {
> };
>
> Would it be enough for you to implement the 'is_callable' trait with the
> desired behavior?

Yep. We just need:

template<typename T> T get();

template<typename Functor, typename R, typename T1, typename T2, ...,
         typename TN>
struct is_callable :
  mpl::bool_c<__is_well_formed(static_cast<R>(get<Functor>()(get<T1>(),
get<T2>(), ..., get<TN>())))>
{
};

The reason I mention is_instantiable instead of __is_well_formed is that
is_instantiable can keep a class template interface, whereas __is_well_formed
would require a new grammar production.

        Doug


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