haar_lib/algebra/
chmax_max.rs

1//! Range Chmax Range Max
2use std::marker::PhantomData;
3
4pub use crate::algebra::{action::*, min_max::Max};
5
6/// Range Chmax Range Max用の代数的構造
7#[derive(Copy, Clone, Default, Debug, PartialEq, Eq)]
8pub struct ChmaxMax<T>(PhantomData<T>);
9
10impl<T> Action for ChmaxMax<T>
11where
12    Max<T>: Monoid,
13    T: Ord,
14{
15    type Output = Max<T>;
16    type Lazy = Max<T>;
17
18    fn convert(value: Self::Output, lazy: Self::Lazy, _: usize) -> Self::Output {
19        Max(value.0.max(lazy.0))
20    }
21}