1
0
Fork 0

Update include.hh

Signed-off-by: subcrip <contact@subc.rip>
This commit is contained in:
subcrip 2024-06-18 15:25:22 +08:00
parent 49da897ccc
commit 507fae6129
1 changed files with 17 additions and 0 deletions

View File

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