pub fn query(&mut self, mut l: usize, mut r: usize) -> T::M {
        l += self.d.len();
        r += self.d.len();
        self.push(l);
        self.push(r);
        let mut res = T::identity(); // monoid identity
        while l <= r {
            if l & 1 == 1 {
                res = T::op(&res, &self.t[l]); // monoid op
                l += 1;
            }
            if r & 1 == 0 {
                res = T::op(&self.t[r], &res); // monoid op
                r -= 1;
            }
            l >>= 1;
            r >>= 1;
        }
        res
    }
/// 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.
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.d.len();
        r += self.d.len();
        self.push(l);
        self.push(r);
        let mut res = T::identity(); // monoid identity
        while l <= r {
            if l & 1 == 1 {
                res = T::op(&res, &self.t[l]); // monoid op
                l += 1;
            }
            if r & 1 == 0 {
                res = T::op(&self.t[r], &res); // monoid op
                r -= 1;
            }
            l >>= 1;
            r >>= 1;
        }
        res
    }
pub fn query ( & mut self , mut l : usize , mut r : usize ) -> T :: M { l += self . d . len ( ) ; r += self . d . len ( ) ; self . push ( l ) ; self . push ( r ) ; let mut res = T :: identity ( ) ; // monoid identity while l <= r { if l & 1 == 1 { res = T :: op ( & res , & self . t [ l ] ) ; // monoid op l += 1 ; } if r & 1 == 0 { res = T :: op ( & self . t [ r ] , & res ) ; // monoid op r -= 1 ; } l >>= 1 ; r >>= 1 ; } res }
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
&mut self
l
usize
r
usize