Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove lower_bound()/upper_bound() from hash_meow/unordered_meow #4607

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions stl/inc/xhash
Original file line number Diff line number Diff line change
Expand Up @@ -1247,36 +1247,6 @@ public:
}
}

_DEPRECATE_STDEXT_HASH_LOWER_BOUND _NODISCARD iterator lower_bound(const key_type& _Keyval) {
return _List._Make_iter(_Find(_Keyval, _Traitsobj(_Keyval)));
}

_DEPRECATE_STDEXT_HASH_LOWER_BOUND _NODISCARD const_iterator lower_bound(const key_type& _Keyval) const {
return _List._Make_const_iter(_Find(_Keyval, _Traitsobj(_Keyval)));
}

_DEPRECATE_STDEXT_HASH_UPPER_BOUND _NODISCARD iterator upper_bound(const key_type& _Keyval) {
auto _Target = _Find_last(_Keyval, _Traitsobj(_Keyval))._Duplicate;
if (_Target) {
_Target = _Target->_Next;
} else {
_Target = _List._Mypair._Myval2._Myhead;
}

return _List._Make_iter(_Target);
}

_DEPRECATE_STDEXT_HASH_UPPER_BOUND _NODISCARD const_iterator upper_bound(const key_type& _Keyval) const {
auto _Target = _Find_last(_Keyval, _Traitsobj(_Keyval))._Duplicate;
if (_Target) {
_Target = _Target->_Next;
} else {
_Target = _List._Mypair._Myval2._Myhead;
}

return _List._Make_const_iter(_Target);
}

private:
struct _Equal_range_result {
_Unchecked_const_iterator _First;
Expand Down
26 changes: 2 additions & 24 deletions stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -1266,30 +1266,8 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect
#define _CXX20_DEPRECATE_U8PATH
#endif // ^^^ warning disabled ^^^

#if !defined(_SILENCE_STDEXT_HASH_LOWER_BOUND_DEPRECATION_WARNING)
#define _DEPRECATE_STDEXT_HASH_LOWER_BOUND \
[[deprecated( \
"warning STL4022: " \
"The hash_meow and unordered_meow containers' non-Standard lower_bound() member was provided for interface " \
"compatibility with the ordered associative containers, and doesn't match the semantics of the " \
"hash_meow or unordered_meow containers. Please use the find() member instead. You can define " \
"_SILENCE_STDEXT_HASH_LOWER_BOUND_DEPRECATION_WARNING to suppress this warning.")]]
#else // ^^^ warning enabled / warning disabled vvv
#define _DEPRECATE_STDEXT_HASH_LOWER_BOUND
#endif // ^^^ warning disabled ^^^

#if !defined(_SILENCE_STDEXT_HASH_UPPER_BOUND_DEPRECATION_WARNING)
#define _DEPRECATE_STDEXT_HASH_UPPER_BOUND \
[[deprecated( \
"warning STL4023: " \
"The hash_meow and unordered_meow containers' non-Standard upper_bound() member was provided for interface " \
"compatibility with the ordered associative containers, and doesn't match the semantics of the " \
"hash_meow or unordered_meow containers. Please use the second iterator returned by the " \
"equal_range() member instead. You can define " \
"_SILENCE_STDEXT_HASH_UPPER_BOUND_DEPRECATION_WARNING to suppress this warning.")]]
#else // ^^^ warning enabled / warning disabled vvv
#define _DEPRECATE_STDEXT_HASH_UPPER_BOUND
#endif // ^^^ warning disabled ^^^
// STL4022 warned about "The hash_meow and unordered_meow containers' non-Standard lower_bound() member"
// STL4023 warned about "The hash_meow and unordered_meow containers' non-Standard upper_bound() member"

// P0966R1 [depr.string.capacity]
#if _HAS_CXX20 && !defined(_SILENCE_CXX20_STRING_RESERVE_WITHOUT_ARGUMENT_DEPRECATION_WARNING) \
Expand Down
6 changes: 0 additions & 6 deletions tests/tr1/tests/hash_map/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#define TEST_NAME "<hash_map>"

#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
#define _SILENCE_STDEXT_HASH_LOWER_BOUND_DEPRECATION_WARNING
#define _SILENCE_STDEXT_HASH_UPPER_BOUND_DEPRECATION_WARNING

#include "tdefs.h"
#include <functional>
Expand Down Expand Up @@ -181,8 +179,6 @@ void test_hash_map() { // test hash_map
CHECK_INT((*v4.find('a')).first, 'a');
CHECK_INT(v4.count('x'), 0);
CHECK_INT(v4.count('a'), 1);
CHECK_INT((*v4.lower_bound('a')).first, 'a');
CHECK_INT((*--v4.upper_bound('a')).first, 'a'); // differs from map

STD pair<Mycont::const_iterator, Mycont::const_iterator> pcc = v4.equal_range('a');
CHECK_INT((*pcc.first).first, 'a');
Expand Down Expand Up @@ -475,8 +471,6 @@ void test_hash_multimap() { // test hash_multimap
CHECK_INT((*v4.find('a')).first, 'a');
CHECK_INT(v4.count('x'), 0);
CHECK_INT(v4.count('a'), 1);
CHECK_INT((*v4.lower_bound('a')).first, 'a');
CHECK_INT((*--v4.upper_bound('a')).first, 'a'); // differs from multimap

STD pair<Mycont::const_iterator, Mycont::const_iterator> pcc = v4.equal_range('a');
CHECK_INT((*pcc.first).first, 'a');
Expand Down
6 changes: 0 additions & 6 deletions tests/tr1/tests/hash_set/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#define TEST_NAME "<hash_set>"

#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
#define _SILENCE_STDEXT_HASH_LOWER_BOUND_DEPRECATION_WARNING
#define _SILENCE_STDEXT_HASH_UPPER_BOUND_DEPRECATION_WARNING

#include "tdefs.h"
#include <functional>
Expand Down Expand Up @@ -164,8 +162,6 @@ void test_hash_set() { // test hash_set
CHECK_INT(*v4.find('a'), 'a');
CHECK_INT(v4.count('x'), 0);
CHECK_INT(v4.count('a'), 1);
CHECK_INT(*v4.lower_bound('a'), 'a');
CHECK_INT(*--v4.upper_bound('a'), 'a'); // differs from set
STD pair<Mycont::const_iterator, Mycont::const_iterator> pcc = v4.equal_range('a');
CHECK_INT(*pcc.first, 'a');
CHECK_INT(*--pcc.second, 'a'); // differs from set
Expand Down Expand Up @@ -462,8 +458,6 @@ void test_hash_multiset() { // test hash_multiset
CHECK_INT(*v4.find('a'), 'a');
CHECK_INT(v4.count('x'), 0);
CHECK_INT(v4.count('a'), 1);
CHECK_INT(*v4.lower_bound('a'), 'a');
CHECK_INT(*--v4.upper_bound('a'), 'a'); // differs from multiset
STD pair<Mycont::const_iterator, Mycont::const_iterator> pcc = v4.equal_range('a');
CHECK_INT(*pcc.first, 'a');
CHECK_INT(*--pcc.second, 'a'); // differs from multiset
Expand Down