Update include.hh
Signed-off-by: subcrip <contact@subc.rip>
This commit is contained in:
parent
49da897ccc
commit
507fae6129
17
include.hh
17
include.hh
|
@ -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)...);}
|
||||||
|
|
Loading…
Reference in New Issue