pub fn query(&mut self, mut l: usize, mut r: usize) -> T::M {
        l += self.app.len();
        r += self.app.len();
        if l < r {
            self.push_to(l);
        }
        self.push_to(r);
        let (mut l_agg, mut r_agg) = (T::identity(), T::identity());
        while l <= r {
            if l & 1 == 1 {
                l_agg = T::op(&l_agg, &self.val[l]);
                l += 1;
            }
            if r & 1 == 0 {
                r_agg = T::op(&self.val[r], &r_agg);
                r -= 1;
            }
            l >>= 1;
            r >>= 1;
        }
        T::op(&l_agg, &r_agg)
    }
/// Returns the aggregate range query on all entries from l to r, inclusive.
///
/// # Panics
///
/// Panics if r >= size. Note that l > r is valid, meaning an empty range.
Returns the aggregate range query on all entries from l to r, inclusive.
Returns the aggregate range query on all entries from l to r inclusive .
pub fn query(&mut self, mut l: usize, mut r: usize) -> T::M {
        l += self.app.len();
        r += self.app.len();
        if l < r {
            self.push_to(l);
        }
        self.push_to(r);
        let (mut l_agg, mut r_agg) = (T::identity(), T::identity());
        while l <= r {
            if l & 1 == 1 {
                l_agg = T::op(&l_agg, &self.val[l]);
                l += 1;
            }
            if r & 1 == 0 {
                r_agg = T::op(&self.val[r], &r_agg);
                r -= 1;
            }
            l >>= 1;
            r >>= 1;
        }
        T::op(&l_agg, &r_agg)
    }
pub fn query ( & mut self , mut l : usize , mut r : usize ) -> T :: M { l += self . app . len ( ) ; r += self . app . len ( ) ; if l < r { self . push_to ( l ) ; } self . push_to ( r ) ; let ( mut l_agg , mut r_agg ) = ( T :: identity ( ) , T :: identity ( ) ) ; while l <= r { if l & 1 == 1 { l_agg = T :: op ( & l_agg , & self . val [ l ] ) ; l += 1 ; } if r & 1 == 0 { r_agg = T :: op ( & self . val [ r ] , & r_agg ) ; r -= 1 ; } l >>= 1 ; r >>= 1 ; } T :: op ( & l_agg , & r_agg ) }
Returns the aggregate range query on all entries from l to r, inclusive.
Returns the aggregate range query on all entries from l to r inclusive .
&mut self
l
usize
r
usize
panics
Panics if r >= size. Note that l > r is valid, meaning an empty range.
Panics if r > = size . Note that l > r is valid meaning an empty range .