Skip to the content.

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

Depends on

Verified with

Code

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