Fix return type of heterogeneous find for sets

PR libstdc++/68190
	* include/bits/stl_multiset.h (multiset::find): Fix return types.
	* include/bits/stl_set.h (set::find): Likewise.
	* testsuite/23_containers/map/operations/2.cc: Test find return types.
	* testsuite/23_containers/multimap/operations/2.cc: Likewise.
	* testsuite/23_containers/multiset/operations/2.cc: Likewise.
	* testsuite/23_containers/set/operations/2.cc: Likewise.

From-SVN: r230113
This commit is contained in:
Jonathan Wakely 2015-11-10 15:12:24 +00:00 committed by Jonathan Wakely
parent 60baa1883c
commit d4a9dffbaa
7 changed files with 40 additions and 8 deletions

View File

@ -1,5 +1,13 @@
2015-11-10 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/68190
* include/bits/stl_multiset.h (multiset::find): Fix return types.
* include/bits/stl_set.h (set::find): Likewise.
* testsuite/23_containers/map/operations/2.cc: Test find return types.
* testsuite/23_containers/multimap/operations/2.cc: Likewise.
* testsuite/23_containers/multiset/operations/2.cc: Likewise.
* testsuite/23_containers/set/operations/2.cc: Likewise.
* doc/xml/manual/status_cxx2017.xml: Update.
* doc/html/*: Regenerate.

View File

@ -680,13 +680,15 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#if __cplusplus > 201103L
template<typename _Kt>
auto
find(const _Kt& __x) -> decltype(_M_t._M_find_tr(__x))
{ return _M_t._M_find_tr(__x); }
find(const _Kt& __x)
-> decltype(iterator{_M_t._M_find_tr(__x)})
{ return iterator{_M_t._M_find_tr(__x)}; }
template<typename _Kt>
auto
find(const _Kt& __x) const -> decltype(_M_t._M_find_tr(__x))
{ return _M_t._M_find_tr(__x); }
find(const _Kt& __x) const
-> decltype(const_iterator{_M_t._M_find_tr(__x)})
{ return const_iterator{_M_t._M_find_tr(__x)}; }
#endif
//@}

View File

@ -699,13 +699,15 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#if __cplusplus > 201103L
template<typename _Kt>
auto
find(const _Kt& __x) -> decltype(_M_t._M_find_tr(__x))
{ return _M_t._M_find_tr(__x); }
find(const _Kt& __x)
-> decltype(iterator{_M_t._M_find_tr(__x)})
{ return iterator{_M_t._M_find_tr(__x)}; }
template<typename _Kt>
auto
find(const _Kt& __x) const -> decltype(_M_t._M_find_tr(__x))
{ return _M_t._M_find_tr(__x); }
find(const _Kt& __x) const
-> decltype(const_iterator{_M_t._M_find_tr(__x)})
{ return const_iterator{_M_t._M_find_tr(__x)}; }
#endif
//@}

View File

@ -54,6 +54,11 @@ test01()
VERIFY( cit == cx.end() );
VERIFY( Cmp::count == 0);
static_assert(std::is_same<decltype(it), test_type::iterator>::value,
"find returns iterator");
static_assert(std::is_same<decltype(cit), test_type::const_iterator>::value,
"const find returns const_iterator");
}
void

View File

@ -54,6 +54,11 @@ test01()
VERIFY( cit == cx.end() );
VERIFY( Cmp::count == 0);
static_assert(std::is_same<decltype(it), test_type::iterator>::value,
"find returns iterator");
static_assert(std::is_same<decltype(cit), test_type::const_iterator>::value,
"const find returns const_iterator");
}
void

View File

@ -54,6 +54,11 @@ test01()
VERIFY( cit == cx.end() );
VERIFY( Cmp::count == 0);
static_assert(std::is_same<decltype(it), test_type::iterator>::value,
"find returns iterator");
static_assert(std::is_same<decltype(cit), test_type::const_iterator>::value,
"const find returns const_iterator");
}
void

View File

@ -54,6 +54,11 @@ test01()
VERIFY( cit == cx.end() );
VERIFY( Cmp::count == 0);
static_assert(std::is_same<decltype(it), test_type::iterator>::value,
"find returns iterator");
static_assert(std::is_same<decltype(cit), test_type::const_iterator>::value,
"const find returns const_iterator");
}
void