No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
Hi, Since small object allocation in heap is bad, I am just wondering the range of the object size that is defined to be small. Regards, Michael |
|
Hi, I have the following code. and it works fine. [CODE] class base { public: base() {}; virtual ~base() {}; virtual void foo() = 0; virtual void boo() = 0; }; class derive2 : public virtual base { public: derive2() {}; virtual ~derive2() {}; virtual void foo() {}; }; class … |
|
Hi All, I just read the book called "C++ coding stardards - 101 rules". And Found there is something I don't understand. [CODE]class FlagNth { public: FlagNth( size_t n ) : current_(0), n_(n) {} // evaluate to true if and only if this is the n-th invocation template<typename T> bool … |
|
Hi all, I don't quite understand the program print the following output. [CODE] class D { public: D(int j):i(j){printf("default %d\n", i);}; D(const D& d):i(d.i){printf("copy %d\n", i);}; private: int i; }; int main(int argc, char** argv) { D d = 2; D d1 = D(23); } [/CODE] output: default 2 default … |
|
Hi all, I am not sure whether the member variables of singleton class should be protected for multhread since I just read some code from colleague. I think it should be. |
|
Hi all, I just wrote a small problem to check gettimeofday in a multi-cores environment. [code] int timediff(double fTimeQvs, double fTimeTcp) { int iTimeDiff; iTimeDiff = (((((int)fTimeQvs)/10000) - (((int)fTimeTcp)/10000)) * 3600) * 1000000; iTimeDiff += ((((((int)fTimeQvs)/100)%100) - ((((int)fTimeTcp)/100)%100)) * 60) * 1000000; iTimeDiff += ((((int)fTimeQvs)%100) - (((int)fTimeTcp)%100)) * 1000000; iTimeDiff … |
|
Hi all, there is a JTable and the cell in one column is set to button by set a customize cell render. However, the size of the button occupies the whole cell region that is not what I want. How can I set fix size to it? Thanks |
|
Hi all, there is a big project which consists of different folders and makefile. I want to build just part of the project using eclipse since every time I build is to build the whole project. Is there anyone knowing how to do? |
|
Hi all, I would like to know in what situation template is used instead of inheritance and vice visa. examples are appreciated. I just know template is static binding while inheritance is dynamic binding. so if speed is concern, template is better. |
|
Hey folks. I am confused as to how i can make a constructor take zero - or lets say 3 arguments. If i do this in my main.cpp: [code] const Vector v1; const Vector v2(1.0, 2.0, 3.0); [/code] And this in my vector.cpp file: [code] Vector::Vector(double new_x, double new_y, double … |
|
I have a question related to function. fun(const int);<-- pass a const int const int fun(int);<--return a const int but what is "fun(int) const"? |
|
Hi when I look at this website [url]http://www.parashift.com/c++-faq-lite/operator-overloading.html[/url], I don't quite understand for the section 13.14 about prefix++ and postfix++. Number x = /* ... */; ++x; // calls Number::operator++(), i.e., calls x.operator++() x++; // calls Number::operator++(int), i.e., calls x.operator++(0) why ++x is calling x.operator++() while x++ is calling calls … |