SegmentTree< AssocT, Aggr > Class Template Reference

Segment tree class templatized by the type associated with every interval and the means of combining them. More...

#include <segment_tree.h>

Public Member Functions

 SegmentTree (std::vector< AssocT > &v)
 
void update (int i, AssocT &new_val)
 
template<typename UnaryFunc >
void update (int i, int j, UnaryFunc change)
 
AssocT range_query (int i, int j)
 

Detailed Description

template<typename AssocT, typename Aggr>
class SegmentTree< AssocT, Aggr >

Segment tree class templatized by the type associated with every interval and the means of combining them.

param AssocT Type of the value associated with each interavl param Aggr A functor dictating how the values of any two subintervals are to be combined to obtain the value of the interval hence formed.

Constructor & Destructor Documentation

template<typename AssocT , typename Aggr >
SegmentTree< AssocT, Aggr >::SegmentTree ( std::vector< AssocT > &  v)

Member Function Documentation

template<typename AssocT , typename Aggr >
AssocT SegmentTree< AssocT, Aggr >::range_query ( int  i,
int  j 
)
template<typename AssocT , typename Aggr >
void SegmentTree< AssocT, Aggr >::update ( int  i,
AssocT &  new_val 
)
template<typename AssocT , typename Aggr >
template<typename UnaryFunc >
void SegmentTree< AssocT, Aggr >::update ( int  i,
int  j,
UnaryFunc  change 
)

The documentation for this class was generated from the following file: