|
Boost : |
Subject: Re: [boost] [move] problem with msvc and BOOST_MOVABLE_BUT_NOT_COPYABLE
From: Ilya Sokolov (ilyasokol_at_[hidden])
Date: 2010-05-28 10:34:41
Thomas Klimpel wrote:
> Ilya Sokolov wrote:
>> Could BOOST_MOVABLE_BUT_NOT_COPYABLE be changed into CRTP base class?
>> It would prevent such errors at compile time. Also, it is quite
>> similar to boost::noncopyable.
>
> It seems my answer to Oliver wasn't clear enough. This is not a problem of Boost.Move,
Yes, it is (arguably). The problem is that error is reported too late.
> but a simple programmer error in "X X::create()" that would have a significant
> performance penalty even if the compiler/linker would accept the code.
There is no implementation of copy ctor in the original example.
How compiler/linker could accept the code? What "performance penalty"
you are talking about?
> However, a CRTP class might be used to convert between the optimized mode
> with unhappy assignment operator signature and the non-optimized mode.
Probably, but that is not important for me. I like the following
benefits:
- one macro less
- uniformity between boost::movable_only and boost::noncopyable
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk