|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Lazy segment tree for range add + range sum. More...
#include <tpl_segment_tree.H>
Public Types | |
| using | Base = Gen_Lazy_Segment_Tree< Add_Sum_Policy< T > > |
Public Types inherited from Aleph::Gen_Lazy_Segment_Tree< Add_Sum_Policy< T > > | |
| using | value_type = typename Policy::value_type |
| using | lazy_type = typename Policy::lazy_type |
| using | Item_Type = value_type |
Additional Inherited Members | |
Public Member Functions inherited from Aleph::Gen_Lazy_Segment_Tree< Add_Sum_Policy< T > > | |
| Gen_Lazy_Segment_Tree (const size_t num, const value_type &init_val=value_type(), Add_Sum_Policy< T > p=Add_Sum_Policy< T >()) | |
Construct with num elements, all equal to init_val. | |
| Gen_Lazy_Segment_Tree (std::initializer_list< value_type > il, Add_Sum_Policy< T > p=Add_Sum_Policy< T >()) | |
| Construct from an initializer list. | |
| Gen_Lazy_Segment_Tree (const Array< value_type > &values, Add_Sum_Policy< T > p=Add_Sum_Policy< T >()) | |
| Construct from an Array<value_type>. | |
| Gen_Lazy_Segment_Tree (const std::vector< value_type > &values, Add_Sum_Policy< T > p=Add_Sum_Policy< T >()) | |
| Construct from a std::vector. | |
| Gen_Lazy_Segment_Tree (const DynList< value_type > &values, Add_Sum_Policy< T > p=Add_Sum_Policy< T >()) | |
| Construct from a DynList. | |
| Gen_Lazy_Segment_Tree (const Gen_Lazy_Segment_Tree &)=default | |
| Gen_Lazy_Segment_Tree (Gen_Lazy_Segment_Tree &&) noexcept(std::is_nothrow_move_constructible_v< Array< value_type > > and std::is_nothrow_move_constructible_v< Array< lazy_type > > and std::is_nothrow_move_constructible_v< Add_Sum_Policy< T > >)=default | |
| Gen_Lazy_Segment_Tree & | operator= (const Gen_Lazy_Segment_Tree &)=default |
| Gen_Lazy_Segment_Tree & | operator= (Gen_Lazy_Segment_Tree &&) noexcept(std::is_nothrow_move_assignable_v< Array< value_type > > and std::is_nothrow_move_assignable_v< Array< lazy_type > > and std::is_nothrow_move_assignable_v< Add_Sum_Policy< T > >)=default |
| void | update (const size_t l, const size_t r, const lazy_type &val) |
Range update: apply val to every a[i] with l <= i <= r. | |
| void | point_update (const size_t i, const lazy_type &delta) |
Point update: apply delta to a[i]. | |
| void | set (const size_t i, const value_type &val) |
Set a[i] = val. | |
| value_type | query (const size_t l, const size_t r) const |
Range query over [l, r]. | |
| value_type | get (const size_t i) const |
Retrieve the value a[i]. | |
| constexpr size_t | size () const noexcept |
| Number of logical elements. | |
| constexpr bool | is_empty () const noexcept |
| True if the tree contains no elements. | |
| Array< value_type > | values () const |
| Reconstruct all original values into an Array. | |
| void | swap (Gen_Lazy_Segment_Tree &other) noexcept(noexcept(std::swap(std::declval< Add_Sum_Policy< T > & >(), std::declval< Add_Sum_Policy< T > & >()))) |
Swap this tree with other in O(1). | |
Lazy segment tree for range add + range sum.
| T | arithmetic type. |
Definition at line 1243 of file tpl_segment_tree.H.
| using Aleph::Lazy_Sum_Segment_Tree< T >::Base = Gen_Lazy_Segment_Tree<Add_Sum_Policy<T> > |
Definition at line 1246 of file tpl_segment_tree.H.