Files
CDAG/Research/core/Comparers.h

29 lines
591 B
C++

#pragma once
#include <unordered_map>
#include "Defines.h"
#include "../inc/glm/common.hpp"
struct u8vec3comparer {
bool operator()(const glm::u8vec3& color1, const glm::u8vec3& color2) const
{
if (color1.r != color2.r)
return color1.r < color2.r;
else if (color1.g != color2.g)
return color1.g < color2.g;
else if (color1.b != color2.b)
return color1.b < color2.b;
else
return false;
}
};
template<typename T>
struct HashComparer
{
bool operator()(const T& x, const T& y) const
{
std::hash<T> hasher;
return hasher.operator()(x) < hasher.operator()(y);
}
};