1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-11-08 19:15:28 +01:00

Introduce std::string_view into wider use (#14368)

This commit is contained in:
sfan5
2024-02-17 15:35:33 +01:00
committed by GitHub
parent fa47af737f
commit 6ca214fefc
74 changed files with 501 additions and 456 deletions

View File

@@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#pragma once
#include <string>
#include <string_view>
static const char hex_chars[] = "0123456789abcdef";
@@ -41,9 +42,9 @@ static inline std::string hex_encode(const char *data, unsigned int data_size)
return ret;
}
static inline std::string hex_encode(const std::string &data)
static inline std::string hex_encode(std::string_view data)
{
return hex_encode(data.c_str(), data.size());
return hex_encode(data.data(), data.size());
}
static inline bool hex_digit_decode(char hexdigit, unsigned char &value)