...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::proto::is_callable — Boolean metafunction which tells whether a type is a callable PolymorphicFunctionObject or not.
// In header: <boost/proto/traits.hpp>
template<typename T>
struct is_callable : mpl::bool_<true-or-false
> {
};
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
.