diff --git a/include.hh b/include.hh index a804a91..c7b760d 100644 --- a/include.hh +++ b/include.hh @@ -429,6 +429,23 @@ istream& operator>>(istream& in, MLLd& num) { } // miscancellous +template +bool chmax(T& lhs, const U& rhs) { + bool ret = lhs < rhs; + if (ret) { + lhs = rhs; + } + return ret; +} +template +bool chmin(T& lhs, const U& rhs) { + bool ret = lhs > rhs; + if (ret) { + lhs = rhs; + } + return ret; +} + #define functor(func) [&](auto&&... val) \ noexcept(noexcept(func(std::forward(val)...))) -> decltype(auto) \ {return func(std::forward(val)...);}