mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-09 15:15:46 +08:00
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:
parent
60baa1883c
commit
d4a9dffbaa
@ -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.
|
||||
|
||||
|
@ -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
|
||||
//@}
|
||||
|
||||
|
@ -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
|
||||
//@}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user