Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Lazy_Sum_Segment_Tree< T > Struct Template Reference

Lazy segment tree for range add + range sum. More...

#include <tpl_segment_tree.H>

Inheritance diagram for Aleph::Lazy_Sum_Segment_Tree< T >:
[legend]
Collaboration diagram for Aleph::Lazy_Sum_Segment_Tree< T >:
[legend]

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_Treeoperator= (const Gen_Lazy_Segment_Tree &)=default
 
Gen_Lazy_Segment_Treeoperator= (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_typevalues () 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).
 

Detailed Description

template<typename T>
struct Aleph::Lazy_Sum_Segment_Tree< T >

Lazy segment tree for range add + range sum.

Template Parameters
Tarithmetic type.

Definition at line 1243 of file tpl_segment_tree.H.

Member Typedef Documentation

◆ Base


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