Boost logo

Boost Users :

From: Kevin Scarr (kscarr_at_[hidden])
Date: 2008-03-22 06:35:06


John Maddock wrote:
> The warnings are raised when a class or structure does *not* have an
> explicit copy-constructor or assignment operator declared, *and* one could
> not be generated automatically by the compiler. However, the warnings are
> issued even though neither the copy-constructor nor the assignment operator
> are ever used - if they were used then you would get a compiler error.

I don't mind the errors, but it seems a warning about something not
required is maybe a little over the top.

> BTW if I remember correctly you get the same warnings if you
> declare a class that inherits from noncopyable which rather destroys the
> whole point of that one :-(

You are correct, you do. I tend to be asked to write programs which are
largely user configurable within their application domain, so all my
application classes tend to inherit from a base class which links the
object to the user configuration (eg user names for objects, user
descriptions, etc) so that all my user-messages are tailored for their
configuration.

Anyway, I always start with the base class inheriting from noncopyable
because I really, really only want one instance of each of these objects
-- many pointers to that instance is fine, but only one actual instance.

Consequently, as you can guess, my compile output is littered with these
warnings.

> HTH, John.

Thanks for your comments!
Kevin


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net