proconlib

This documentation is automatically generated by competitive-verifier/competitive-verifier

View the Project on GitHub anqooqie/proconlib

:heavy_check_mark: Concept for commutative monoid (tools/commutative_monoid.hpp)

template <typename M>
concept commutative_monoid = tools::monoid<M>;

It is a concept that represents a commutative monoid. Note that semantic constraints must be guaranteed by the user.

Semantically, you can define that the result of M::op is undefined depending on the arguments. For example, you can define that integer addition is not defined for overflowing pairs.

Constraints

Time Complexity

License

Author

Depends on

Required by

Verified with

Code

#ifndef TOOLS_COMMUTATIVE_MONOID_HPP
#define TOOLS_COMMUTATIVE_MONOID_HPP

#include "tools/monoid.hpp"

namespace tools {
  template <typename M>
  concept commutative_monoid = tools::monoid<M>;
}

#endif
#line 1 "tools/commutative_monoid.hpp"



#line 1 "tools/monoid.hpp"



#include <concepts>

namespace tools {
  template <typename M>
  concept monoid = requires(typename M::T x, typename M::T y) {
    { M::op(x, y) } -> std::same_as<typename M::T>;
    { M::e() } -> std::same_as<typename M::T>;
  };
}


#line 5 "tools/commutative_monoid.hpp"

namespace tools {
  template <typename M>
  concept commutative_monoid = tools::monoid<M>;
}


Back to top page