This documentation is automatically generated by competitive-verifier/competitive-verifier
#include "tools/chmax.hpp"
template <typename M, typename N>
bool chmax(M& lhs, N rhs);
It runs lhs = std::max(lhs, rhs);
.
It returns true
if lhs
has been updated.
Otherwise, it returns false
.
#ifndef TOOLS_CHMAX_HPP
#define TOOLS_CHMAX_HPP
#include <type_traits>
#include <utility>
namespace tools {
template <typename M, typename N>
bool chmax(M& lhs, const N& rhs) {
bool updated;
if constexpr (::std::is_integral_v<M> && ::std::is_integral_v<N>) {
updated = ::std::cmp_less(lhs, rhs);
} else {
updated = lhs < rhs;
}
if (updated) lhs = rhs;
return updated;
}
}
#endif
#line 1 "tools/chmax.hpp"
#include <type_traits>
#include <utility>
namespace tools {
template <typename M, typename N>
bool chmax(M& lhs, const N& rhs) {
bool updated;
if constexpr (::std::is_integral_v<M> && ::std::is_integral_v<N>) {
updated = ::std::cmp_less(lhs, rhs);
} else {
updated = lhs < rhs;
}
if (updated) lhs = rhs;
return updated;
}
}