[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Calling constructors with temporary class instance

From: tthunder
Subject: Calling constructors with temporary class instance
Date: 21 Mar 2006 04:06:24 -0800
User-agent: G2/0.2

Hi @all,

Currently I am developing a property class framework, and it works
perfectly with Windows compilers now (even Dev-C++ - MiniGW).

But I still have problems on Linux and g++ (3.3.4 - pre 3.3.5)

Look at this example (it works with all other compilers):

property<int> myIntProperty(property<int>::options());

this can extendend to:

property<int> myIntProperty(property<int>::options() <<


Simply said: I create an instance of the class property<int>::options
inside the constuctor call of property<int>.

But this doesn't work with g++. I found out, that g++ treats this line
as an function declaration (or something similar). Strange bugs appear.

I know, that I can call the constructor like this:

property<int>:options myIntPropertyOptions;
property<int> myIntProperty(myIntPropertyOptions);

But the general design of my framework is based on the other system. So
how can I get it working?

Thanks much,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]