This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
rvalue references in libstdc++
- From: "Chris Jefferson" <chris at bubblescope dot net>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Mon, 30 Apr 2007 21:11:41 +0100
- Subject: rvalue references in libstdc++
Hello,
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"
semantics.
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
something like:
#ifdef rvalrefs
#define _GLIBCXX_MOVE(x) move(x)
#else
#define _GLIBCXX_MOVE(x) x
#endif
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.
Comments?
Chris