This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]