rvalue references in libstdc++
Mon Apr 30 20:11:00 GMT 2007
I've been looking at updating the v7 branch to support "true" rvalue
references. The code already there which implements it with a
wrapper-hack will (purposefully) map very easily to the "true"
Obviously it would be nice to avoid code duplication, but at the same
time I assume the library will need to still function without rvalue
references, in C++03 mode.
There are as far as I can see only two real problems.
1) A bunch of new functions
2) References to std::move all over the place.
Therefore, my plan is as follows:
1) Stick #ifdefs around the new functions
2) Define a macro, something like _GLIBCXX_MOVE, which is defined
#define _GLIBCXX_MOVE(x) move(x)
#define _GLIBCXX_MOVE(x) x
These two cases seem to cover 99% (possibly 100%) of the issues
involving keeping the library working both with and without rvalue
references. Obviously submitting this code is waiting on the rvalue
reference support in the compiler itself.
More information about the Libstdc++