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

Improve the interface of SortKey #555

Merged
merged 7 commits into from Jan 27, 2022

Conversation

joka921
Copy link
Member

@joka921 joka921 commented Jan 26, 2022

  • Add consistent comparison
  • Add starts_with function.

* Add consistent comparison
* Add starts_with function.
builds pass consistently.
@joka921 joka921 mentioned this pull request Jan 26, 2022
bool starts_with(const SortKey& rhs) {
return get().starts_with(rhs.get());
}

Copy link
Collaborator

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?

Copy link
Member Author

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.

Copy link
Collaborator

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

Copy link
Member

@hannahbast hannahbast left a 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

@joka921 joka921 merged commit de55d92 into ad-freiburg:master Jan 27, 2022
@joka921 joka921 deleted the sort_key_compare_and_startswith branch January 27, 2022 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants