Boost logo

Boost :

From: jeremy_at_[hidden]
Date: 2001-09-17 16:07:50


Today I discovered boost.org and I must say that it will take a long
time before I fully appreciate everything at this wonderful site.

I am having a slight problem with noncopyable and I'm curious if
anyone can help me out. I have a concrete base and derived class and
I want both to be noncopyable:
class A : noncopyable {};
class B : public A, noncopyable {};

MSVC 6 sp5 gives error C2584 'B' : "direct base 'noncopyable' is
inaccessible; already a base of 'A'"
while gcc 2.95.2 gives test.cpp:3: warning: direct base `noncopyable'
inaccessible in `B' due to ambiguity

I'm assuming that inside B, there is no way to refer to noncopyable
without ambiguity, and the compilers don't like that. It would be
nice if I got a warning that I could suppress, but MSVC calls this an
error.

If this is true, I suppose I can make noncopyable a virtual base
class in situations like this (will this add any overhead if
noncopyable has no data members??). I could also make a noncopyable2
which is the same as noncopyable. I can't say I particularly like
either of these options :(.

Any help would be most appreciated!

Jeremy Todd


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk