To create a functor, you
Construct a handle
Construct and initialize a compatible body
Bind that body to the handle
The simplest way to do this is to use a global template function to create the body, such as the rwtMakeFunctor0() function in the following example.
Example 69 shows the minimal code required for building and using a functor.
#include <rw/functor/functor0.h> void func(void); // build a functor to encapsulate function func RWFunctor0 functor = rwtMakeFunctor0((void(*)(void))0,func); //invoke the functor functor(); |
Copyright © Rogue Wave Software, Inc. All Rights Reserved.
The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.