#include <hex.h>
Definition at line 74 of file hex.h.
◆ vector()
| std::vector< uint8_t > epee::from_hex::vector |
( |
boost::string_ref |
src | ) |
|
|
static |
- Returns
- An std::vector of unsigned integers from the
src
Definition at line 88 of file hex.cpp.
91 auto include = [](
char input) {
97 auto count = std::count_if(src.begin(), src.end(), include);
101 throw std::length_error{
"Invalid hexadecimal input length" };
104 std::vector<uint8_t> result;
105 result.reserve(
count / 2);
108 auto data = src.data();
111 auto char_to_int = [](
const char *input) {
112 switch (std::tolower(*input)) {
129 default:
throw std::range_error{
"Invalid hexadecimal input" };
134 while (data[0] !=
'\0') {
136 if (!include(data[0])) {
142 auto high = char_to_int(data++);
143 auto low = char_to_int(data++);
145 result.push_back(high << 4 | low);
mdb_size_t count(MDB_cursor *cur)
The documentation for this struct was generated from the following files:
- /home/abuild/rpmbuild/BUILD/electroneum-5.0.0.4/contrib/epee/include/hex.h
- /home/abuild/rpmbuild/BUILD/electroneum-5.0.0.4/contrib/epee/src/hex.cpp