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]

[patch] Simplify signatures of std::list members: merge, splice, insert, erase


C++0x changed the signature of std::list::merge to take an rvalue
reference, and then LWG DR 1133 [1] added the lvalue reference
signature back as an overload. Our implementation follows that history
rather literally, as we changed list::merge to take an rvalue in C++0x
mode, then later [2] added back an overload taking an lvalue and
calling merge(std::move(__x)).

It seems to me that it would be simpler to consistently have the
lvalue version do all the work, and just make the rvalue one forward
to that. That's what patch1.txt does (the same change can be done to
debug and profile mode lists).

Any objections to this change?

patch2.txt then does the same thing for splice(), introducing a
__const_iterator typedef [3] to make the signatures consistent for
different language modes.

I think this makes the code more maintainable, as there are fewer #if
blocks with subtly different signatures.

Any objections to this one too, including doing the same for debug
mode and profile mode?


[1] http://cplusplus.github.io/LWG/lwg-defects.html#1133
[2] https://gcc.gnu.org/ml/gcc-patches/2009-12/msg00699.html
[3] https://gcc.gnu.org/ml/libstdc++/2014-08/msg00151.html

Attachment: patch1.txt
Description: Text document

Attachment: patch2.txt
Description: Text document


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