![]() SourcePro C++ 12.0 |
SourcePro® C++ API Reference Guide |
SourcePro C++ Documentation Home |
Abstract base class for the family of functor bodies that are invoked with one caller argument and return a value. More...
#include <rw/functor/RWTFunctorR1Imp.h>
A function object, or a functor, encapsulates a call to an associated global or member function. When a functor is invoked, it calls the associated function.
RWTFunctorR1Imp<SR,S1> is the abstract base class for the family of functor bodies that take one caller argument at invocation time and return a value.
Each derived class name appends either aG (for global) or an M (for member), to indicate whether it is invoked upon an object. Static member functions use the G version since there is no object associated with the call.
The class name may also append A1 or A2 to indicate that it takes callee arguments at construction time. These arguments are stored and added to the caller argument at invocation time.
The six concrete class names are:
this object, no callee argumentsthis object, one callee argumentthis object, two callee argumentsthis object, but no callee argumentsthis object, and one callee argumentthis object, and two callee argumentsThese concrete classes are templatized on the signature of the function that is encapsulated, as well as on the signature of the functor invocation.
The template parameters describe the invocation signature of the functor and the function call it encapsulates. These parameters are:
SR The return type of the functorS1 The type of the first functor signature argumentCallee The class type that declares a member functionDR The return type of the function; the compiler must be able to convert this to the SR typeD1 The type of the first function signature argument; the compiler must be able to convert to this from the S1 typeA1 The type of the first client data argumentA2 The type of the second client data argumentThe make() function is the only member of these functor classes that is intended to be accessed directly; it is often called through one of the rwtMakeFunctorR1() convenience mechanisms. All other members must be accessed through an RWTFunctorR1<SR,S1> handle.
#include <rw/functor/RWTFunctorR1GImp.h> int foo(float); // Create a functor that calls foo(): RWTFunctorR1<int,float> func; func = RWTFunctorR1GImp<int,float,int,float>::make(foo); // Invoke Functor int result = func(7.0);
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.