Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2006-08-11 10:54:13


On Mon, 24 Jul 2006 17:36:49 -0400, "Chris Weed" <chrisweed_at_[hidden]>
wrote:

>It can be difficult to understand the difference between if_ and
>eval_if. If I derive get_value_type from nonconstructible, this would
>not have compiled.

Regardless of what originally motivated it, nonconstructible (I'd
prefer non_constructible, or non_instantiatable) is neither more nor
less useful as noncopyable (note: I won't reply to aggressive
follow-ups on this... resource management and all that). Some years
ago I proposed a simple syntactical addition to mark member functions
as "not defined", in the class declaration (typically copy
constructors and copy assignment operators), so that a diagnostic
could be immediately emitted on anything that needed their definition
(rather than processing *all* the TUs to see if a definition existed
somewhere). At that time it was mostly ignored, but I see that many of
the ideas raised in newsgroups years ago are being reprised by
prominent members of the committee, and have wide acceptance. So it
could be that someone would grab that one too. To go back to your
solution, I'd add a base class having a private copy constructor, so
that "self-initialization"

  M m = m;

would be inhibited as well. Keep it in your personal toolbox ;-)

--
[ Gennaro Prota, C++ developer. For hire ]

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