help-gplusplus
[Top][All Lists]
Advanced

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

Re: boost::noncopyable and warning: ... override "=" or copy-ctor


From: Pedro Lamarão
Subject: Re: boost::noncopyable and warning: ... override "=" or copy-ctor
Date: Fri, 24 Aug 2007 14:38:00 -0000
User-agent: G2/1.0

On Aug 22, 4:27 pm, Seweryn Habdank-Wojewódzki <habd...@gmail.com>
wrote:
> Hi
>
> Can any one explain me why is I am using boost::noncopyable then Weffc+
> + displays my warning e.g.:
>
> roadsim.cpp:37: warning: 'class road::detail::RoadSimImpl' has pointer
> data members
> roadsim.cpp:37: warning:   but does not override
> 'road::detail::RoadSimImpl(const road::detail::RoadSimImpl&)'
> roadsim.cpp:37: warning:   or 'operator=(const
> road::detail::RoadSimImpl&)'
>
> It means that boost::noncopyable do not works or what?

No; assuming you are using boost::noncopyable appropriately, it means
the diagnostic mechanism is not detecting that, in this case, your
class simply isn't copyable.

The warning is useful because, if your class holds dynamically
allocated resources, the default copy constructor and copy assignment
operator generated by the compiler won't be appropriate. For this kind
of classes you must define what "copying" means, to deal with the
"shared resource" problem.

--
 Pedro Lamarão



reply via email to

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