-
Notifications
You must be signed in to change notification settings - Fork 310
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
Create separate evmc::hex library for hex encoding/decoding #575
Conversation
I'm reading intro to |
for (auto it = hex_begin; it != hex.end(); ++it) | ||
{ | ||
const auto h = *it; | ||
if (std::isspace(h)) |
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.
Hm why do you want to allow whitespace? If this is to skip extra whitespace from command line, it's better to handle it in command line code.
Also currently it looks to allow "0x12"
and " 12"
(also "0x 12"
and "1 2"
), but not " 0x12"
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.
Yes, this is what I want for simplicity. This is useful for loading hex from files to get rid of line breaks.
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.
Just hex.erase(std::remove_if(hex.begin(), hex.end()), std::isspace), hex.end())
them!
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.
This will not work with input iterators (planned change). In the end we can have hex_decoding_iterator
and strip_whitespace_iterator
but I think having just one is simpler.
lib/hex/hex.cpp
Outdated
const std::error_category& hex_category() noexcept | ||
{ | ||
// Create static category object. This involves mutex-protected dynamic initialization. | ||
// Because of the C++ defect 253, the {} syntax is used. |
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.
"valarray helper functions are almost entirely useless" ? http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#253
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.
No description provided.