Add compare operators to nostd::string_view#124
Add compare operators to nostd::string_view#124reyang merged 5 commits intoopen-telemetry:masterfrom
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
|
g-easy
left a comment
There was a problem hiding this comment.
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 |
* Add compare operators to nostd::string_view * Added tests
…-validate-1.x Update dependency protoc-gen-validate to v1.0.4.bcr.2
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.