FreePOOMA  2.4.1
Public Types
FunctorResult< Functor, ArgumentType > Struct Template Reference

Where Pooma uses functor objects, STL functors can typically be used, where operator() is used to define the function. More...

#include <FunctorResult.h>

List of all members.

Public Types

typedef ArgumentType Type_t

Detailed Description

template<class Functor, class ArgumentType>
struct FunctorResult< Functor, ArgumentType >

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;
 };
 

Member Typedef Documentation

template<class Functor, class ArgumentType>
typedef ArgumentType FunctorResult< Functor, ArgumentType >::Type_t

The documentation for this struct was generated from the following file: