-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[libc++] P2944R3: Constrained comparisions - variant
#141396
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
Changes from 4 commits
a7517fd
ab710f4
dd32d6c
23ebfd7
f862580
ba27f7f
8483790
98b05c4
c64a4ec
6e11bf0
2b671b5
3cb270b
475d1f3
d1cfb12
3c9e9c3
7d5ff27
df79b72
e08025e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1161,9 +1161,16 @@ struct __tuple_equal<0> { | |
}; | ||
|
||
template <class... _Tp, class... _Up> | ||
# if _LIBCPP_STD_VER >= 26 | ||
requires(requires(const _Tp& __t, const _Up& __u) { | ||
{ __t == __u } -> __boolean_testable; | ||
} && ...) && (sizeof...(_Tp) == sizeof...(_Up)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't this patch resolve your concerns: #132021 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does, but it's not yet available in most compilers. Note that I'm only asking for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. In that case. I'll split tuple in a separate patch. |
||
# endif | ||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool | ||
operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) { | ||
# if _LIBCPP_STD_VER < 26 | ||
static_assert(sizeof...(_Tp) == sizeof...(_Up), "Can't compare tuples of different sizes"); | ||
# endif | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure guarding this buys us much. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe guarding this doesn't won't noticeably improve throughput because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm seeing this from the other side actually. It's guarded, so my first instinct is to wonder whether this restriction has been lifted in C++26. Just having the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From a maintainace point of view IMO this guard tells that if in year 2042, C++29 becomes the min supported mode, this could be easily removed. |
||
return __tuple_equal<sizeof...(_Tp)>()(__x, __y); | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.