Haio 0.2.X
Homebrew Asset IO/CDN
Loading...
Searching...
No Matches
matches.cpp
Go to the documentation of this file.
1#include <haio_util.hpp>
2
3#include <algorithm>
4
5namespace Haio::Util {
6
7bool matches(Bytes data, Bytes magic) {
8 return data.size() >= magic.size() && std::equal(magic.begin(), magic.end(), data.begin());
9}
10
11bool matches(Bytes data, std::string_view magic) {
12 return data.size() >= magic.size()
13 && std::equal(magic.begin(), magic.end(), data.begin(), [](char a, uint8_t b) {
14 return static_cast<uint8_t>(a) == b;
15 });
16}
17
18}
bool matches(Bytes data, Bytes magic)
Definition matches.cpp:7
std::span< const uint8_t > Bytes