Here's a way you could implement C#'s property concept:
We want the public member variable INITIALIZED to be read-only. Here's how to implement it.
class A
{
public:
A() : INITIALIZED(initialized_)
{
initialized_ = 100;
}
void reconf(int i)
{...
Haha..I guess I should just accept the fact that int() is equivalent to int (*)().
Thanks guys!
Rome did not create a great empire by having meetings, they did it by
killing all those who opposed them.
- janvier -
So int() == int (*)()?
I thought the correct declaration for a pointer to a function is int (*)() rather than int().
Can anyone explain why int () is same as int (*)()? I am confused because int () for me looks like an int declaration that is very different from int(*)().
Rome did not create...
Nope.
This one I found on the C++ Standards (ANSI ISO/IEC 14882) document. Here's the link here:
http://www.kuzbass.ru:8086/docs/isocpp/over.html
It is in the third item of section 3. Here are the complete examples:
void h(int());
void h(int (*)()); // redeclaration of...
I found a declaration like this:
void h(int());
What does this mean? Is that argument a pointer to function or what? If it was intended as a pointer to function then should it be declared like this:
void h(int (*)());
Rome did not create a great empire by having meetings, they did it...
It would but I am tryinh to undestand thread cancellation which is why I used pthread_cancel and pthread_testcancel.
Rome did not create a great empire by having meetings, they did it by
killing all those who opposed them.
- janvier -
Hello all!
I am experimenting with pthreads. Now I have encountered an unexpected behavior (at least I think it is). The code is show below:
#include <iostream>
#include <pthread.h>
using namespace std;
void* task(void* arg)
{
cout << "Starting task" << endl;
for(int count =...
Thanks uolj! Can't I do the one you did for a multimap?
Rome did not create a great empire by having meetings, they did it by
killing all those who opposed them.
- janvier -
Isn't that the predicate for the multimap is for sorting only?
Rome did not create a great empire by having meetings, they did it by
killing all those who opposed them.
- janvier -
There is also the ADAPTIVE Communication Environment (ACE). It provides nice abstractions for your C++ needs.
Rome did not create a great empire by having meetings, they did it by
killing all those who opposed them.
- janvier -
Hi all!
The STL multimap accepts duplicate keys such that the following entry is valid for a multimap:
KEY VALUE
foo bar
jack jill
Now the problem is, multimap also accepts duplicate entries such that if I would add another foo, bar pair the multimap will accept it. So...
You could always check your platform's man pages for this. You just type man gethostbyname. If the man pages are not available you can also google it and typing man gethostbyname also.
Rome did not create a great empire by having meetings, they did it by
killing all those who opposed them.
-...
What platform are you compiling this from?
If you are compiling under Solaris, you would need to add either of the following during linking:
-lxnet -lnsl -lsocket
Hope this helps! [thumbsup]
Rome did not create a great empire by having meetings, they did it by
killing all those who...
I have read in most articles that STL is not thread-safe or should not be used in multi-threading? Why? What are other alternatives or how should one make a thread-safe STL?
Rome did not create a great empire by having meetings, they did it by
killing all those who opposed them.
- janvier -
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.