GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  REPEAT (3)

NAME

FBB::repeat - call a (member) function a fixed number of times

CONTENTS

SYNOPSIS

#include <bobcat/repeat>

DESCRIPTION

The FBB::repeat function template allows a function or member function to be called a certain number of times. The functions or member functions may define arguments. Arguments to these functions are specified when repeat is called, and are perfectly forwarded by the repeat function template to the (member) function called by repeat.

The first argument of the repeat function template defines the number of times the (member) function must be called.

The FBB::repeat function template are defined inline, allowing the compiler to ‘optimize away\(cq 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

-

REPEAT FUNCTION TEMPLATE

The repeat function template is declared as:

template <typename Counter, typename First, typename ...Params> void repeat(Counter counter, First &&first, Params &&...params);

In this declaration,
o Counter represents the counter\(cqs type. Usually an int or size_t. When calling repeat counter must be initialized to the number of times repeat must call the (member) function (see below);
o First represents the prototype of a function or the name of a class. name of a class. Likewise, first either is the address (name) of the function to be called or the name of an object of class type First. In the latter case the object may or may not be a const object.
o ...Params represents the set of parameter types of arguments which must be perfectly forwarded to the called function. If first represents a class type object, the first argument must be the address of a member function of the class First.

EXAMPLES

#include <iostream>
#include <iterator>
#include <algorithm>

#include \(dq../repeat\(dq

using namespace std; using namespace FBB;

class Object { public: void member(int argc, char **argv) const; void member2(size_t &rept, int argc, char **argv); };

void Object::member(int argc, char **argv) const { cout << \(dqmember called\n\(dq; copy(argv, argv + argc, ostream_iterator<char const *>(cout, \(dq\n\(dq)); }

void Object::member2(size_t &rept, int argc, char **argv) { cout << \(dqmember2 called, iteration \(dq << rept++ << \(dq\n\(dq; copy(argv, argv + argc, ostream_iterator<char const *>(cout, \(dq\n\(dq)); }

void fun() { cout << \(dqFun called\n\(dq; }

int main(int argc, char **argv) { Object object;

cout << \(dq\n\(dq \(dq*** The number of arguments determines the repeat-count ***\n\n\(dq;

cout << \(dqFun without arguments:\n\(dq; repeat(argc, fun);

cout << \(dqObject receiving argc and argv:\n\(dq; repeat(argc, object, &Object::member, argc, argv);

cout << \(dqObject receiving argc and argv, showing the iteration count:\n\(dq; size_t count = 0; repeat(argc, object, &Object::member2, count, argc, argv);

Object const obj; cout << \(dqConst Object receiving argc and argv:\n\(dq; repeat(argc, obj, &Object::member, argc, argv);

}

FILES

bobcat/repeat - defines the class interface

SEE ALSO

bobcat(7)

BUGS

Be careful when using overloaded functions, as the template argument resolution mechanism may be unable to determine which function to call. If overloaded functions must be used, a static_cast is likely required to disambiguate your intentions.

DISTRIBUTION FILES

o bobcat_3.25.01-x.dsc: detached signature;
o bobcat_3.25.01-x.tar.gz: source archive;
o bobcat_3.25.01-x_i386.changes: change log;
o libbobcat1_3.25.01-x_*.deb: debian package holding the libraries;
o libbobcat1-dev_3.25.01-x_*.deb: debian package holding the libraries, headers and manual pages;
o http://sourceforge.net/projects/bobcat: public archive location;

BOBCAT

Bobcat is an acronym of ‘Brokken\(cqs Own Base Classes And Templates\(cq.

COPYRIGHT

This is free software, distributed under the terms of the GNU General Public License (GPL).

AUTHOR

Frank B. Brokken (f.b.brokken@rug.nl).

Search for    or go to Top of page |  Section 3 |  Main Index


libbobcat-dev_3&.25&.01-x&.tar&.gz FBB::REPEAT (3bobcat) 2005-2015

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.