LazySegTreeAddMaxSpec

Struct LazySegTreeAddMaxSpec 

Source
pub struct LazySegTreeAddMaxSpec<T>(/* private fields */);
Expand description

Specification for lazy segment trees that perform range add updates with maximum queries.

This spec works with data type T where:

  • T supports addition and multiplication by usize
  • T has a zero constant and supports ordering
  • Updates are applied uniformly to all elements in a range

Trait Implementations§

Source§

impl<T> LazySegTreeSpec for LazySegTreeAddMaxSpec<T>
where T: Clone + Add<Output = T> + ConstLowerBound + Ord,

Source§

const ID: Self::T = <T as ConstLowerBound>::MIN

Identity element for T.
Source§

type T = T

Source§

type U = T

Source§

fn op_on_data(d1: &Self::T, d2: &Self::T) -> Self::T

Combine two child values into a parent value.
Source§

fn op_on_update(u1: &Self::U, u2: &Self::U) -> Self::U

Compose two updates. If update a is applied before b, then the composed update should be op_on_update(a, b) (document the intended order in non-commutative cases).
Source§

fn op_update_on_data(u: &Self::U, d: &Self::T, _size: usize) -> Self::T

Apply an update u to a node’s stored aggregate d which represents size leaves. For example, for range-add + range-sum: op_update_on_data(u, d, size) = d + u * size.
Source§

fn op_on_update_option( existing_tag: &Option<Self::U>, new_tag: &Self::U, ) -> Option<Self::U>

Helper to combine an existing optional tag with a new tag. Read more

Auto Trait Implementations§

§

impl<T> Freeze for LazySegTreeAddMaxSpec<T>

§

impl<T> RefUnwindSafe for LazySegTreeAddMaxSpec<T>
where T: RefUnwindSafe,

§

impl<T> Send for LazySegTreeAddMaxSpec<T>
where T: Send,

§

impl<T> Sync for LazySegTreeAddMaxSpec<T>
where T: Sync,

§

impl<T> Unpin for LazySegTreeAddMaxSpec<T>
where T: Unpin,

§

impl<T> UnwindSafe for LazySegTreeAddMaxSpec<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.