-
Notifications
You must be signed in to change notification settings - Fork 13
makes most operators hidden friends #471
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
base: main
Are you sure you want to change the base?
Conversation
This ensures that they're not placed in their function names' respecitve overload sets, which has a considerable impact on build times and on compiler diagnostics (as they're not listed as failed candidates when overload resolution fails).
Running an include tracer indicated that placing `size_hint_impl.h` in this header should prevent link-time errors when attempting to incidentally format `SizeHint`.
c8fe86b
to
438c023
Compare
@@ -910,6 +910,9 @@ class Choice<__private::TypeList<Ts...>, Tags...> final { | |||
const Choice<__private::TypeList<RhsTs...>, RhsTag, RhsTags...>& r) = | |||
delete; | |||
|
|||
// Stream support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Stream support | |
// Stream support. |
} // namespace __private | ||
|
||
namespace __private { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can avoid closing and opening the namespace here
/// #[doc.overloads=array.cmp.array] | ||
template <class U> | ||
requires(::sus::cmp::ExclusiveStrongOrd<T, U>) | ||
constexpr friend std::strong_ordering operator<=>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we write friend constexpr
as the order for these keywords consistently (the one above is in that order)?
std::make_index_sequence<N>()); | ||
} | ||
|
||
// Stream support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Stream support | |
// Stream support. |
@@ -36,7 +36,8 @@ struct VarError { | |||
Reason reason; | |||
|
|||
/// Satisfies the [`Eq`]($sus::cmp::Eq) concept. | |||
constexpr bool operator==(const VarError& rhs) const noexcept = default; | |||
constexpr friend bool operator==(const VarError& lhs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constexpr friend bool operator==(const VarError& lhs, | |
friend constexpr bool operator==(const VarError& lhs, |
} // namespace sus | ||
|
||
// fmt support. | ||
template <class Char> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question - can this go to the bottom?
@@ -748,6 +748,47 @@ _sus_pure constexpr _self _self::from_ne_bytes( | |||
return _self(val); | |||
} | |||
|
|||
_sus_pure constexpr u32 _self::count_ones() const& noexcept { | |||
return __private::count_ones(primitive_value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did these bodies need to move?
@@ -0,0 +1,56 @@ | |||
// Copyright 2023 Google LLC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Copyright 2023 Google LLC | |
// Copyright 2025 Google LLC |
@@ -60,3 +60,5 @@ | |||
#define _pointer 1 | |||
#define _primitive ::sus::num::__private::ptr_type<::sus::mem::size_of<uintptr_t>()>::unsigned_type | |||
#include "sus/num/__private/unsigned_integer_methods_impl.inc" | |||
// Comment to prevent clang-format from deleting this line and sorting includes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Comment to prevent clang-format from deleting this line and sorting includes | |
// This must come last, after the types are fully defined. |
@@ -775,6 +775,7 @@ class [[nodiscard]] Result final { | |||
{ | |||
return eq(l, r); | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ensures that they're not placed in their function names' respective overload sets, which has a considerable impact on build times and on compiler diagnostics (as they're not listed as failed candidates when overload resolution fails).