
AMDG Max wrote:
To make it clearer, I'm finding something like this: class Foo { int & i_; Foo& operator=(const Foo& rhs) { if(&rhs == this) return *this; i_ = rhs.i_; return *this; } }
this is not accepted by my VC9 compiler.
It isn't? I don't see a problem (other than that it may not be what you intend), and I just compiled the above snippet with vc9.
However, I'm also curious on the question you raised for me: :-)
Is it possible to make a class which has reference type members default constructible?
AFAIK, the answer is no. I hope and don't hope there's a different answer.
It sounds like you need to be using pointers instead of references.
Yes, it seems to be the only way, as far as I don't to make thing more complex by using another layer of indirectness.
Well, the indirectness is still there with references. It's just hidden. In Christ, Steven Watanabe