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
Improve the interface of SortKey
#555
Improve the interface of SortKey
#555
Conversation
joka921
commented
Jan 26, 2022
- Add consistent comparison
- Add starts_with function.
* Add consistent comparison * Add starts_with function.
builds pass consistently.
bool starts_with(const SortKey& rhs) { | ||
return get().starts_with(rhs.get()); | ||
} | ||
|
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.
If get
is marked as constexpr
, this function can be too if I'm not missing something obvious?
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.
The obvious thing you are missing is,
that constexpr string is not yet implemented in GCC/clang and then also
the starts_with
function of string
is not constexpr (which would also be pointless).
I have added a TODO, there is quite some other stuff to do.
But, what you could have said, is that starts_with
is const noexcept
and
some other functions of this class are also noexcept.
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.
Of course, I only checked the string_view variant, which is obviously constexpr
and noexcept annotations.
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.
Quick 1-1 with Johannes, minor comments