mirror of git://gcc.gnu.org/git/gcc.git
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>
|
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/xml/manual/status_cxx2017.xml: Update.
|
||||||
* doc/html/*: Regenerate.
|
* doc/html/*: Regenerate.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -680,13 +680,15 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
||||||
#if __cplusplus > 201103L
|
#if __cplusplus > 201103L
|
||||||
template<typename _Kt>
|
template<typename _Kt>
|
||||||
auto
|
auto
|
||||||
find(const _Kt& __x) -> decltype(_M_t._M_find_tr(__x))
|
find(const _Kt& __x)
|
||||||
{ return _M_t._M_find_tr(__x); }
|
-> decltype(iterator{_M_t._M_find_tr(__x)})
|
||||||
|
{ return iterator{_M_t._M_find_tr(__x)}; }
|
||||||
|
|
||||||
template<typename _Kt>
|
template<typename _Kt>
|
||||||
auto
|
auto
|
||||||
find(const _Kt& __x) const -> decltype(_M_t._M_find_tr(__x))
|
find(const _Kt& __x) const
|
||||||
{ return _M_t._M_find_tr(__x); }
|
-> decltype(const_iterator{_M_t._M_find_tr(__x)})
|
||||||
|
{ return const_iterator{_M_t._M_find_tr(__x)}; }
|
||||||
#endif
|
#endif
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -699,13 +699,15 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
||||||
#if __cplusplus > 201103L
|
#if __cplusplus > 201103L
|
||||||
template<typename _Kt>
|
template<typename _Kt>
|
||||||
auto
|
auto
|
||||||
find(const _Kt& __x) -> decltype(_M_t._M_find_tr(__x))
|
find(const _Kt& __x)
|
||||||
{ return _M_t._M_find_tr(__x); }
|
-> decltype(iterator{_M_t._M_find_tr(__x)})
|
||||||
|
{ return iterator{_M_t._M_find_tr(__x)}; }
|
||||||
|
|
||||||
template<typename _Kt>
|
template<typename _Kt>
|
||||||
auto
|
auto
|
||||||
find(const _Kt& __x) const -> decltype(_M_t._M_find_tr(__x))
|
find(const _Kt& __x) const
|
||||||
{ return _M_t._M_find_tr(__x); }
|
-> decltype(const_iterator{_M_t._M_find_tr(__x)})
|
||||||
|
{ return const_iterator{_M_t._M_find_tr(__x)}; }
|
||||||
#endif
|
#endif
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,11 @@ test01()
|
||||||
VERIFY( cit == cx.end() );
|
VERIFY( cit == cx.end() );
|
||||||
|
|
||||||
VERIFY( Cmp::count == 0);
|
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
|
void
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,11 @@ test01()
|
||||||
VERIFY( cit == cx.end() );
|
VERIFY( cit == cx.end() );
|
||||||
|
|
||||||
VERIFY( Cmp::count == 0);
|
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
|
void
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,11 @@ test01()
|
||||||
VERIFY( cit == cx.end() );
|
VERIFY( cit == cx.end() );
|
||||||
|
|
||||||
VERIFY( Cmp::count == 0);
|
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
|
void
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,11 @@ test01()
|
||||||
VERIFY( cit == cx.end() );
|
VERIFY( cit == cx.end() );
|
||||||
|
|
||||||
VERIFY( Cmp::count == 0);
|
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
|
void
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue