Commit f7f07df5 by Jonathan Wakely Committed by Jonathan Wakely

Avoid ambiguity between C++2a std::erase_if and LFTS version

These calls should have been qualified to avoid ADL anyway, but in C++2a
it becomes essential to qualify the calls in experimental::erase because
std::erase_if is also declared and the calls become ambiguous.

	* include/experimental/forward_list (experimental::erase): Qualify
	call to erase_if.
	* include/experimental/list (experimental::erase): Likewise.
	* include/std/forward_list (std::erase): Likewise.
	* include/std/list (std::erase): Likewise.

From-SVN: r268356
parent 2104ca71
2019-01-29 Jonathan Wakely <jwakely@redhat.com> 2019-01-29 Jonathan Wakely <jwakely@redhat.com>
* include/experimental/forward_list (experimental::erase): Qualify
call to erase_if.
* include/experimental/list (experimental::erase): Likewise.
* include/std/forward_list (std::erase): Likewise.
* include/std/list (std::erase): Likewise.
* testsuite/20_util/reference_wrapper/result_type.cc: Disable for * testsuite/20_util/reference_wrapper/result_type.cc: Disable for
C++2a. C++2a.
* testsuite/20_util/reference_wrapper/typedefs-2.cc: Likewise. * testsuite/20_util/reference_wrapper/typedefs-2.cc: Likewise.
......
...@@ -54,7 +54,9 @@ inline namespace fundamentals_v2 ...@@ -54,7 +54,9 @@ inline namespace fundamentals_v2
erase(forward_list<_Tp, _Alloc>& __cont, const _Up& __value) erase(forward_list<_Tp, _Alloc>& __cont, const _Up& __value)
{ {
using __elem_type = typename forward_list<_Tp, _Alloc>::value_type; using __elem_type = typename forward_list<_Tp, _Alloc>::value_type;
erase_if(__cont, [&](__elem_type& __elem) { return __elem == __value; }); std::experimental::erase_if(__cont, [&](__elem_type& __elem) {
return __elem == __value;
});
} }
namespace pmr { namespace pmr {
......
...@@ -54,7 +54,9 @@ inline namespace fundamentals_v2 ...@@ -54,7 +54,9 @@ inline namespace fundamentals_v2
erase(list<_Tp, _Alloc>& __cont, const _Up& __value) erase(list<_Tp, _Alloc>& __cont, const _Up& __value)
{ {
using __elem_type = typename list<_Tp, _Alloc>::value_type; using __elem_type = typename list<_Tp, _Alloc>::value_type;
erase_if(__cont, [&](__elem_type& __elem) { return __elem == __value; }); experimental::erase_if(__cont, [&](__elem_type& __elem) {
return __elem == __value;
});
} }
namespace pmr { namespace pmr {
......
...@@ -78,8 +78,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -78,8 +78,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
erase(forward_list<_Tp, _Alloc>& __cont, const _Up& __value) erase(forward_list<_Tp, _Alloc>& __cont, const _Up& __value)
{ {
using __elem_type = typename forward_list<_Tp, _Alloc>::value_type; using __elem_type = typename forward_list<_Tp, _Alloc>::value_type;
return erase_if(__cont, return std::erase_if(__cont, [&](__elem_type& __elem) {
[&](__elem_type& __elem) { return __elem == __value; }); return __elem == __value;
});
} }
_GLIBCXX_END_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION
} // namespace std } // namespace std
......
...@@ -102,8 +102,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -102,8 +102,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
erase(list<_Tp, _Alloc>& __cont, const _Up& __value) erase(list<_Tp, _Alloc>& __cont, const _Up& __value)
{ {
using __elem_type = typename list<_Tp, _Alloc>::value_type; using __elem_type = typename list<_Tp, _Alloc>::value_type;
return erase_if(__cont, return std::erase_if(__cont, [&](__elem_type& __elem) {
[&](__elem_type& __elem) { return __elem == __value; }); return __elem == __value;
});
} }
_GLIBCXX_END_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION
} // namespace std } // namespace std
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment