| Home | Libraries | People | FAQ | More

## Struct template is_callable

boost::proto::is_callable — Boolean metafunction which tells whether a type is a callable PolymorphicFunctionObject or not.

## Synopsis

    // In header: <boost/proto/traits.hpp>

    template<typename T>
    struct is_callable :  mpl::bool_<true-or-false> {
    };

## Description

`proto::is_callable<>` is used by the `proto::when<>` transform to determine whether a function type `R(A1,...An)` is a CallableTransform or an ObjectTransform. The former are evaluated using `proto::call<>` and the later with `proto::make<>`. If `proto::is_callable<R>::value` is `true`, the function type is a CallableTransform; otherwise, it is an ObjectTransform.

Unless specialized for a type `T`, `proto::is_callable<T>::value` is computed as follows:

- If `T` is a template type `X<Y0,...Yn>`, where all `Yx` are types for `x` in `[0,n]`, `proto::is_callable<T>::value` is `boost::is_same<Yn, proto::callable>::value`.

- If `T` is derived from `proto::callable`, `proto::is_callable<T>::value` is `true`.

- Otherwise, `proto::is_callable<T>::value` is `false`.