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

add operator to convert frozen::string to std::string view (with c++17 and more) #180

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

gvollant
Copy link

@gvollant gvollant commented Dec 1, 2024

With this operator, it is more easy to convert

const std::unordered_map<std::string_view, std::string_view> network_map({

to

frozen::unordered_map<frozen::string, frozen::string, 1047>network_map = {

constexpr bool operator==(std::basic_string_view<chr_t> other) const {
if (size_ != other.size())
return false;
for (std::size_t i = 0; i < size_; ++i)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could use other.compare here

@serge-sans-paille
Copy link
Owner

LGTM, with the minor extra nit in comment. Could you just add a test case that involves these two additions? thanks.

@Neustradamus
Copy link

@gvollant: Thanks for your recent comments after a very long time without comeback from you!

Can you look others too?

It is always missing:

Thanks in advance.

@gvollant
Copy link
Author

gvollant commented Dec 9, 2024

@Neustradamus write on gvollant/smartversion#1

@gvollant
Copy link
Author

gvollant commented Dec 9, 2024

@serge-sans-paille I rewrote it to use the std::string_view internal compare code (which use often SIMD optimisation)

@serge-sans-paille
Copy link
Owner

@gvollant looks good! can you just add a test case and we're done :-)

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.

3 participants