
Le samedi 05 mars 2011 à 01:43 -0800, Artyom a écrit :
----- Original Message ----
From: Dave Abrahams <dave@boostpro.com> To: boost@lists.boost.org Sent: Sat, March 5, 2011 12:21:50 AM Subject: Re: [boost] [xint] Performance of fixed-size large integers
At Fri, 4 Mar 2011 13:58:36 -0800 (PST), Artyom wrote:
I personally think that COW approach would be very useful for most of users while move is "nice-to-have".
That's interesting, but it doesn't help me form my own opinion. Maybe if you told us on what basis you came to that conclusion, it would be more helpful. Have you done any tests to see how easily/quickly a type implemented with move emulation works as compared to one implemented with COW? Have you got concrete examples?
I'm not talking about performance I'm talking about what users would do.
How many developers would write:
{ ... foo.set_value(boost::move(some_big_int)); // some big int goes out of scope }
Over
{ ... foo.set_value(some_big_int); // some big int goes out of scope }
In case you really need a copy of the value and not reference/const reference.
We should remember that not all Boost audience is familiar with "movable" concept. Even good C++ programmers do not really live on the edge and use the-state-of-the-art tools.
The opposite view also stands: Move will benefit to most C++ classes/functions while only those who have designed their classes to use COW can afford not to use Move. Designing a COW class is more complex than a Move enabled one. My KISS understanding of move is that it's telling me: use functional programming style, so that you don't need std::move. Of course, this is not always possible, but I think that this limits the scope of your (valid) point. Ivan