Skip to the content.

:heavy_check_mark: library/algebra/monoid/Min.hpp

Depends on

Required by

Verified with

Code

template <typename X> struct MonoidMin {
    using value_type = X;
    static constexpr X op(const X &x, const X &y) noexcept {
        return std::min(x, y);
    }
    static constexpr void Rchop(X &x, const X &y) {
        if (x > y)
            x = y;
    }
    static constexpr void Lchop(const X &x, X &y) {
        if (y > x)
            y = x;
    }
    static constexpr X unit() { return std::numeric_limits<X>::max() / 2; }
    static constexpr bool commute = true;
};
#line 1 "library/algebra/monoid/Min.hpp"
template <typename X> struct MonoidMin {
    using value_type = X;
    static constexpr X op(const X &x, const X &y) noexcept {
        return std::min(x, y);
    }
    static constexpr void Rchop(X &x, const X &y) {
        if (x > y)
            x = y;
    }
    static constexpr void Lchop(const X &x, X &y) {
        if (y > x)
            y = x;
    }
    static constexpr X unit() { return std::numeric_limits<X>::max() / 2; }
    static constexpr bool commute = true;
};
Back to top page