fixed indentation for uuid class

This commit is contained in:
Sascha Kühl 2026-04-03 19:14:38 +02:00
parent 920fdc68ed
commit 40dfc30dae
2 changed files with 73 additions and 73 deletions

View File

@ -6,7 +6,6 @@
#include <cstdint>
namespace matador::utils {
class uuid {
public:
using uuid_array = std::array<uint32_t, 4>;
@ -39,13 +38,7 @@ private:
// Hash specialization to allow use in unordered containers
template<>
struct std::hash<matador::utils::uuid> {
std::size_t operator()(const matador::utils::uuid& u) const noexcept {
std::size_t h = 0;
for (const uint32_t val : u.data()) {
h ^= std::hash<uint32_t>{}(val) + 0x9e3779b9 + (h << 6) + (h >> 2);
}
return h;
}
std::size_t operator()(const matador::utils::uuid &u) const noexcept;
};
#endif //MATADOR_UUID_HPP

View File

@ -3,7 +3,6 @@
#include <random>
namespace matador::utils {
uuid uuid::generate() {
std::random_device rd;
std::mt19937_64 gen(rd());
@ -73,3 +72,11 @@ bool operator<( const uuid& lhs, const uuid& rhs ) {
return lhs._data < rhs._data;
}
}
std::size_t std::hash<matador::utils::uuid>::operator()(const matador::utils::uuid &u) const noexcept {
std::size_t h = 0;
for (const uint32_t val: u.data()) {
h ^= std::hash<uint32_t>{}(val) + 0x9e3779b9 + (h << 6) + (h >> 2);
}
return h;
}