Skip to main content

SeekByAccCond

Struct SeekByAccCond 

Source
pub struct SeekByAccCond<Spec, L, F>
where L: LazyMapMonoid,
{ acc: L::Agg, f: F, _marker: PhantomData<fn() -> (Spec, L)>, }

Fields§

§acc: L::Agg§f: F§_marker: PhantomData<fn() -> (Spec, L)>

Implementations§

Source§

impl<Spec, L, F> SeekByAccCond<Spec, L, F>
where L: LazyMapMonoid, F: FnMut(&L::Agg) -> bool,

Source

pub fn new(f: F) -> Self

Examples found in repository?
crates/competitive/src/data_structure/treap.rs (line 434)
428    pub fn find_by_acc_cond<F>(&mut self, f: F) -> Option<BstNodeId<TreapSpec<M, L>>>
429    where
430        F: FnMut(&L::Agg) -> bool,
431    {
432        let split = Split::new(
433            &mut self.root,
434            SeekByAccCond::<TreapSpec<M, L>, L, F>::new(f),
435            EqualSide::Right,
436        );
437        let node = split.right()?.leftmost();
438        self.node_id_manager.registered_node_id(node)
439    }
More examples
Hide additional examples
crates/competitive/src/data_structure/implicit_splay_tree.rs (line 369)
360    pub fn partition_point_acc<F>(&mut self, left: usize, mut pred: F) -> usize
361    where
362        F: FnMut(&T::Agg) -> bool,
363    {
364        let mut split3 = Split3::seek_by_size(&mut self.root, left..);
365        let front_size = split3
366            .left()
367            .map(|node| node.into_data().size)
368            .unwrap_or_default();
369        let split = split3.split_mid(SeekByAccCond::new(|acc| !pred(acc)), EqualSide::Right);
370        let index = split
371            .left()
372            .map(|node| node.into_data().size)
373            .unwrap_or_default();
374        front_size + index
375    }
crates/competitive/src/data_structure/implicit_treap.rs (line 473)
464    pub fn partition_point_acc<F>(&mut self, left: usize, mut pred: F) -> usize
465    where
466        F: FnMut(&T::Agg) -> bool,
467    {
468        let mut split3 = Split3::seek_by_size(&mut self.root, left..);
469        let front_size = split3
470            .left()
471            .map(|node| node.into_data().size)
472            .unwrap_or_default();
473        let split = split3.split_mid(SeekByAccCond::new(|acc| !pred(acc)), EqualSide::Right);
474        let index = split
475            .left()
476            .map(|node| node.into_data().size)
477            .unwrap_or_default();
478        front_size + index
479    }

Trait Implementations§

Source§

impl<Spec, L, F> BstSeeker for SeekByAccCond<Spec, L, F>
where Spec: BstSpec<Data: BstDataAccess<LazyMap, Value = LazyMapElement<L>>>, L: LazyMapMonoid, F: FnMut(&L::Agg) -> bool,

Source§

type Spec = Spec

Source§

fn bst_seek(&mut self, node: BstImmutRef<'_, Self::Spec>) -> Ordering

Auto Trait Implementations§

§

impl<Spec, L, F> Freeze for SeekByAccCond<Spec, L, F>

§

impl<Spec, L, F> RefUnwindSafe for SeekByAccCond<Spec, L, F>

§

impl<Spec, L, F> Send for SeekByAccCond<Spec, L, F>
where <L as LazyMapMonoid>::Agg: Send, F: Send, PhantomData<fn() -> (Spec, L)>: Send,

§

impl<Spec, L, F> Sync for SeekByAccCond<Spec, L, F>
where <L as LazyMapMonoid>::Agg: Sync, F: Sync, PhantomData<fn() -> (Spec, L)>: Sync,

§

impl<Spec, L, F> Unpin for SeekByAccCond<Spec, L, F>

§

impl<Spec, L, F> UnsafeUnpin for SeekByAccCond<Spec, L, F>

§

impl<Spec, L, F> UnwindSafe for SeekByAccCond<Spec, L, F>

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> ToArrayVecScalar for T

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.