Boost logo

Boost :

From: Christopher Woods (cwoods_eol_at_[hidden])
Date: 2007-05-29 12:49:44

Costin Calisov wrote:
> Ok, good to know that, but, I'm still curious what is wrong with my code.
> Why is it passing a compiler and why is failing on the other?

Probably just a choice of internal compiler design...

The following appears to work on MSVC:

class final_base

class final : public virtual final_base
    final(const final&);

Notice that I used protected construction and specified a private copy
constructor for final.

The latter gets around's MSVC error re: no copy constructor or explicit
copy constructor. It seems that MSVC compiler is implicitly defining an
explicit copy constructor so you have to declare one to get around it.

The former lets you use final without having to remember to inherit from
it protected/private:

class B : final
    B() {}

class C : B
    C() {} // Error - no derive from the B but msg is not obvious IMHO

int main()
    B t1;
    B t2(t1); // Okay - because of private copy constructor in final



Boost list run by bdawes at, gregod at, cpdaniel at, john at