cp_library_rs/
chmin.rs

1/// `chmin!(x1, x2, ..., xn)`:`x1`,`x2`,...,`xn`のうち最小のものを、`x1`に代入する
2/// - 代入があったとき、`true`を返す
3#[macro_export]
4macro_rules! chmin {
5    ( $a:expr, $b:expr $(,)* ) => {{
6        if $a > $b {
7            $a = $b;
8            true
9        } else {
10            false
11        }
12    }};
13    ( $a:expr, $b:expr, $c:expr $(,$other:expr)* $(,)* ) => {{
14        chmin! {
15            $a,
16            ($b).min($c)
17            $(,$other)*
18        }
19    }};
20}