P0646R1 Improving the Return Value of Erase-Like Algorithms I
commit43c7ee54a2c49b8c153f1a072d87574be0de72a4
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 4 Jul 2018 20:15:01 +0000 (4 20:15 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 4 Jul 2018 20:15:01 +0000 (4 20:15 +0000)
treef8187ffa593c73538b8ab7645b745b26ab555289
parent142c83445dcc73380dcc58529200e07469051ee9
P0646R1 Improving the Return Value of Erase-Like Algorithms I

In C++2a the remove, remove_if and unique members of std::list and
std::forward_list have been changed to return the number of elements
removed. This is an ABI change for the remove members and the
non-template unique members, so an abi-tag is used to give those symbols
new mangled names in C++2a mode. For the function templates the return
type is part of the mangled name so no abi-tag is needed.

* include/bits/forward_list.h (__cpp_lib_list_remove_return_type):
Define.
(forward_list::__remove_return_type): Define typedef as size_type or
void, according to __cplusplus value.
(_GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG): Define macro as abi-tag or
empty, according to __cplusplus value.
(forward_list::remove, forward_list::unique): Use typedef and macro
to change return type and add abi-tag for C++2a.
(forward_list::remove_if<Pred>, forward_list::unique<BinPred>): Use
typedef to change return type for C++2a.
* include/bits/forward_list.tcc (_GLIBCXX20_ONLY): Define macro.
(forward_list::remove, forward_list::remove_if<Pred>)
(forward_list::unique<BinPred>): Return number of removed elements
for C++2a.
* include/bits/list.tcc (_GLIBCXX20_ONLY): Define macro.
(list::remove, list::unique, list::remove_if<Predicate>)
(list::unique<BinaryPredicate>): Return number of removed elements
for C++2a.
* include/bits/stl_list.h (__cpp_lib_list_remove_return_type): Define.
(list::__remove_return_type): Define typedef as size_type or
void, according to __cplusplus value.
(_GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG): Define macro as abi-tag or
empty, according to __cplusplus value.
(list::remove, list::unique): Use typedef and macro to change return
type and add abi-tag for C++2a.
(list::remove_if<Predicate>, list::unique<BinaryPredicate>): Use
typedef to change return type for C++2a.
* include/std/version (__cpp_lib_list_remove_return_type): Define.
* testsuite/23_containers/forward_list/operations/
remove_cxx20_return.cc: New.
* testsuite/23_containers/forward_list/operations/
unique_cxx20_return.cc: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@262423 138bc75d-0d04-0410-961f-82ee72b054a4
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/forward_list.h
libstdc++-v3/include/bits/forward_list.tcc
libstdc++-v3/include/bits/list.tcc
libstdc++-v3/include/bits/stl_list.h
libstdc++-v3/include/std/version
libstdc++-v3/testsuite/23_containers/forward_list/operations/remove_cxx20_return.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/forward_list/operations/unique_cxx20_return.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/list/operations/remove_cxx20_return.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/list/operations/unique_cxx20_return.cc [new file with mode: 0644]