#ifndef RFL_COMPARISONS_HPP_ #define RFL_COMPARISONS_HPP_ #include "rfl/Result.hpp" namespace rfl { template struct EqualTo { template static Result validate(T _value) noexcept { constexpr auto threshold = static_cast(_threshold); if (_value != threshold) { return Error("Value expected to be equal to " + std::to_string(threshold) + ", but got " + std::to_string(_value) + "."); } return _value; } }; template struct Minimum { template static Result validate(T _value) noexcept { constexpr auto threshold = static_cast(_threshold); if (_value < threshold) { return Error("Value expected to be greater than or equal to " + std::to_string(threshold) + ", but got " + std::to_string(_value) + "."); } return _value; } }; template struct ExclusiveMinimum { template static Result validate(T _value) noexcept { constexpr auto threshold = static_cast(_threshold); if (_value <= threshold) { return Error("Value expected to be greater than " + std::to_string(threshold) + ", but got " + std::to_string(_value) + "."); } return _value; } }; template struct Maximum { template static Result validate(T _value) noexcept { constexpr auto threshold = static_cast(_threshold); if (_value > threshold) { return Error("Value expected to be less than or equal to " + std::to_string(threshold) + ", but got " + std::to_string(_value) + "."); } return _value; } }; template struct ExclusiveMaximum { template static Result validate(T _value) noexcept { constexpr auto threshold = static_cast(_threshold); if (_value >= threshold) { return Error("Value expected to be less than " + std::to_string(threshold) + ", but got " + std::to_string(_value) + "."); } return _value; } }; template struct NotEqualTo { template static Result validate(T _value) noexcept { constexpr auto threshold = static_cast(_threshold); if (_value == threshold) { return Error("Value expected to not be equal to " + std::to_string(threshold) + ", but got " + std::to_string(_value) + "."); } return _value; } }; } // namespace rfl #endif