Re: Temporary object omits constructor

2008-05-21 Thread Stefan Schulze Frielinghaus
On Wed, 2008-05-21 at 10:32 -0700, Joe Buck wrote: > You forgot to add > > A::A(const A&) { ++c;} > > The missing call is to the copy constructor. Since you didn't declare > one, the compiler inserts one, and it doesn't increment the counter. Arghl your right. I removed the copy constructor two

Re: Temporary object omits constructor

2008-05-21 Thread Joe Buck
On Wed, May 21, 2008 at 07:14:27PM +0200, Stefan Schulze Frielinghaus wrote: > Hello all, > > I just tried to easily show how many temporary objects get created in my > program. I created a test application like this one: > #include > > struct A { > static int c, d; > A() { ++c; } >

Temporary object omits constructor

2008-05-21 Thread Stefan Schulze Frielinghaus
Hello all, I just tried to easily show how many temporary objects get created in my program. I created a test application like this one: #include struct A { static int c, d; A() { ++c; } ~A() { ++d; } void operator+=(const A&) { } A operator+(const A&) {