FBB::repeat - call a (member) function a number of times
SYNOPSIS
#include <bobcat/foreach>
DESCRIPTION
The FBB::repeat function templates allows a function or function object to
be called a certain number of times.
The STL repeat function templates requires a counter set to the number of
times a function or function object is activated. No argument and no local
context is passed to the function (object). The for_each function
templates can be used for that.
The FBB::repeat function templates are defined inline,
allowing the compiler to `optimize away' the repeat function call
itself.
NAMESPACE
FBB
All constructors, members, operators and manipulators, mentioned in this
man-page, are defined in the namespace FBB.
INHERITS FROM
-
OVERLOADED FUNCTIONS
In the following description several template type parameters are
used. They are:
Counter represents the counter's type. Usually it is an int
or size_t.
Function represents a pointer to a classless or static class
member function or a function object;
Class represents a class type;
Member represents a pointer to a Class member function.
void repeat(Counter counter, Function &fun): fun is called counter times. No argument is passed to fun.
void repeat(Counter counter, Class &object, Member member): object.*member is called counter times, passing no argument to
object.*member.
void repeat(Counter counter, Class *object, Member member): object->*member is called counter times, passing no argument to
object->*member.
Class and Member may also be defined as const objects.
EXAMPLES
#include <iostream>
#include <bobcat/repeat>
using namespace std;
using namespace FBB;
class Object
{
public:
void member();
};
void Object::member()
{
cout << "member called\n";
}
int main(int argc, char **argv)
{
Object object;
repeat(argc, object, &Object::member);
}