Hi,
I have a base class and derived a class from the base class, i want to print & read the data for the object created for the derived class,so i have overloaded both the << and >> operators and also have done the foward declaration.
Below is the code snippet,
#include <iostream>
class... (3 Replies)
Hello,
i am using the sigaction function to handle the SIGCHLD signal.Is it possible to use a class member function as the handler function (the sa_handler member of the sigaction structure)?
The function's signature is:
void (*sa_handler)(int);so i don't think i can use a static member function... (2 Replies)
Hi, i have a question about C++. Is it possible to declare a class with a member ot the same class? For example, a linked list or i want to convert this C code to C++ class (Elemento)
typedef struct elemento
{
char name;
char value;
List<struct elemento> ltElementos;
... (7 Replies)
Hi friends,
The derived class cannot access the base class's variables in my program. You can have a look at my code, I am actually using class templates.
#include <iostream>
using namespace std;
template <class T>
class Sum
{
friend void Check(Sum &s, T a, T b)
{
T x,... (2 Replies)
I have the following class and thought that when I call the set command to set a member, I always use value. Would that be fine?
class ModMisfit {
protected:
Real dtau;
Real mdacc;
Real mindist;
bool hw;
Source** src;
public:
void ... (7 Replies)
Hi all!
I am trying to register a device in an existing device class, but I am
having trouble getting the pointer to an existing class.
I can create a class in a module, get the pointer to it and then use
it to register the device with:
*cl = class_create(THIS_MODULE, className);... (0 Replies)
I have the two class definition as follows.
class A { public: int a; };
class B : virtual public A{ };
The size of class A is shown as 4, and size of class B is shown as 16. Why is this effect ?. (2 Replies)
There is base class B, and two derived classes D1 and D2 derived from Base. Base class B, have two data members ( public or protected or private or if any). D1 should inherit both these data members, and D2 should be deriving only one member from Base class. Is this kind of design possible without... (1 Reply)
Why, here the size of class 'Derived' is 8 ?
class Base1
{
public:
virtual void f() { }
};
class Base2
{
public:
virtual void f() { }
};
class Derived : public Base1, Base2
{
public:
virtual void f() { }
}; (1 Reply)
Discussion started by: techmonk
1 Replies
LEARN ABOUT DEBIAN
repeat
FBB::repeat(3bobcat) repeated function calls FBB::repeat(3bobcat)NAME
FBB::repeat - call a (member) function a fixed number of times
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' 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's 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 rep-
resents 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 "../repeat"
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 << "member called
";
copy(argv, argv + argc, ostream_iterator<char const *>(cout, "
"));
}
void Object::member2(size_t &rept, int argc, char **argv)
{
cout << "member2 called, iteration " << rept++ << "
";
copy(argv, argv + argc, ostream_iterator<char const *>(cout, "
"));
}
void fun()
{
cout << "Fun called
";
}
int main(int argc, char **argv)
{
Object object;
cout << "
"
"*** The number of arguments determines the repeat-count ***
";
cout << "Fun without arguments:
";
repeat(argc, fun);
cout << "Object receiving argc and argv:
";
repeat(argc, object, &Object::member, argc, argv);
cout << "Object receiving argc and argv, showing the iteration count:
";
size_t count = 0;
repeat(argc, object, &Object::member2, count, argc, argv);
Object const obj;
cout << "Const Object receiving argc and argv:
";
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.01.00-x.dsc: detached signature;
o bobcat_3.01.00-x.tar.gz: source archive;
o bobcat_3.01.00-x_i386.changes: change log;
o libbobcat1_3.01.00-x_*.deb: debian package holding the libraries;
o libbobcat1-dev_3.01.00-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's Own Base Classes And Templates'.
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).
libbobcat1-dev_3.01.00-x.tar.gz 2005-2012 FBB::repeat(3bobcat)