sys: Finish implementing constants view and its store

This commit is contained in:
WerWolv
2021-09-09 12:58:44 +02:00
parent a1d9794c0e
commit ccac2e497d
8 changed files with 111 additions and 33 deletions

View File

@@ -6,6 +6,7 @@
#include <array>
#include <cstring>
#include <cctype>
#include <functional>
#include <memory>
#include <optional>
@@ -158,6 +159,20 @@ namespace hex {
float float16ToFloat32(u16 float16);
inline bool equalsIgnoreCase(const std::string &left, const std::string &right) {
return std::equal(left.begin(), left.end(), right.begin(), right.end(), [](char a, char b) {
return tolower(a) == tolower(b);
});
}
inline bool containsIgnoreCase(const std::string &a, const std::string &b) {
auto iter = std::search(a.begin(), a.end(), b.begin(), b.end(), [](char ch1, char ch2) {
return std::toupper(ch1) == std::toupper(ch2);
});
return iter != a.end();
}
namespace scope_guard {
#define SCOPE_GUARD ::hex::scope_guard::ScopeGuardOnExit() + [&]()