FreePOOMA
2.4.1
|
Where Pooma uses functor objects, STL functors can typically be used, where operator() is used to define the function. More...
#include <FunctorResult.h>
Public Types | |
typedef ArgumentType | Type_t |
Where Pooma uses functor objects, STL functors can typically be used, where operator() is used to define the function.
STL functors typically either give no type information about the argument and return, or specify both through argument_type and result_type. For Pooma, we prefer to use templated functors, so result_type is a function of argument_type, which is why we use the class FunctorResult<> to externally provide the mapping from argument_type to result_type.
The default behaviour simply uses the argument_type for the result_type which is sufficient for most STL function objects and most pooma function objects. A couple of examples where you would want to specialize this class for different behaviour are:
template<class T> struct FunctorResult<logical_not<T>,T> { typedef bool Type_t; };
template<int D, class T> struct FunctorResult<MyNorm,Vector<D,T> > { typedef T Type_t; };
typedef ArgumentType FunctorResult< Functor, ArgumentType >::Type_t |