-
Notifications
You must be signed in to change notification settings - Fork 440
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
Add compare operators to nostd::string_view #124
Conversation
Codecov Report
@@ Coverage Diff @@
## master #124 +/- ##
==========================================
+ Coverage 93.45% 93.50% +0.04%
==========================================
Files 71 71
Lines 1697 1724 +27
==========================================
+ Hits 1586 1612 +26
- Misses 111 112 +1
|
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.
Please also api/test/nostd/string_view_test.cc
…try-cpp into maxgolov/comparator
Yes, I will add the tests. |
Could we also add hash functions for nostd::string_view that make it usable with unordered_map and unordered_set? I can do this in a separate PR or it could be added in this one. |
Are these part of standard std::string_view ? I'd like to ensure that our implementations of nostd classes are as close to standard library as possible. Why? Because that keeps an option on a table to substitute one for another in a neat way. I was planning to submit a separate PR that validates our nostd classes behavior side-by-side with Standard Library, C++17, C++20, as well as gsl::span. Abseil is another good candidate. Comparing just the bare minimum of classes we implement, and the methods we use in SDK. |
Do you mean something like |
Yeah it looks like it is available in c++ 20, yeah I was thinking of something like that. You could also modify std::hash that way you don't have to do something like this std::unordered_set<nostd::string_view, nostd::MyHash> set |
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.
LGTM. Please rebase.
* Add compare operators to nostd::string_view * Added tests
This change adds missing methods that exist on standard std::string_view , allowing to use nostd::string_view as key in std::map and other containers.