|
Boost : |
From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-10-17 11:33:09
Background: This post is of relevance to those who have an interest in move
constructors. Mojo is a technique and framework for optimizing away
unnecessary copying of temporaries.
Peter Dimov found a flaw that's quite a showstopper. If class Y is mojoed,
then the following fails to compile:
void TakeConstY(const Y&);
TakeConstY(Y());
This mojo bug was found relatively late for two reasons: (1) nobody would
think that that won't work given that pretty much anything else that makes
sense works; (2) many compilers do accept the code above without issuing an
error.
But! Hope dies last! I am now working on a new approach that could use
elements of the old approach. Basically I am looking for the library-helped
solution that would minimally impact user code, and in the most
easy-to-understand ways. The impact can't be eliminated, this was clear with
mojo from the beginning, but the point is to reduce it to the minimum.
Given that the last version of the article and the code will be
significantly different from today's, I feel under no obligation to CUJ or
to TCS anymore, so I am making the files available for those interested. See
http://moderncppdesign.com/mojo. I believe the material is interesting for
those exploring C++ types with new properties.
Cheers,
Andrei
-- All new! THE C++ Seminar: Oct. 28-30 in Vancouver, WA. http://www.thecppseminar.com/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk