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

Range add + range sum policy. More...

#include <tpl_segment_tree.H>

Public Types

using value_type = T
 
using lazy_type = T
 

Static Public Member Functions

static constexpr T combine (const T &a, const T &b) noexcept
 
static constexpr T apply (const T &val, const T &delta, size_t count) noexcept
 
static constexpr T compose (const T &old_lazy, const T &new_lazy) noexcept
 
static constexpr T value_identity () noexcept
 
static constexpr T lazy_identity () noexcept
 

Detailed Description

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

Range add + range sum policy.

Policy for Gen_Lazy_Segment_Tree implementing the classic "range add" + "range sum" segment tree.

  • combine(a, b) = a + b
  • apply(val, delta, count) = val + delta * count
  • compose(old, new) = old + new
Template Parameters
Tarithmetic type.

Definition at line 727 of file tpl_segment_tree.H.

Member Typedef Documentation

◆ lazy_type

template<typename T >
using Aleph::Add_Sum_Policy< T >::lazy_type = T

Definition at line 730 of file tpl_segment_tree.H.

◆ value_type

template<typename T >
using Aleph::Add_Sum_Policy< T >::value_type = T

Definition at line 729 of file tpl_segment_tree.H.

Member Function Documentation

◆ apply()

template<typename T >
static constexpr T Aleph::Add_Sum_Policy< T >::apply ( const T val,
const T delta,
size_t  count 
)
inlinestaticconstexprnoexcept

Definition at line 737 of file tpl_segment_tree.H.

References Aleph::count().

◆ combine()

template<typename T >
static constexpr T Aleph::Add_Sum_Policy< T >::combine ( const T a,
const T b 
)
inlinestaticconstexprnoexcept

Definition at line 732 of file tpl_segment_tree.H.

◆ compose()

template<typename T >
static constexpr T Aleph::Add_Sum_Policy< T >::compose ( const T old_lazy,
const T new_lazy 
)
inlinestaticconstexprnoexcept

Definition at line 743 of file tpl_segment_tree.H.

References Aleph::divide_and_conquer_partition_dp().

◆ lazy_identity()

template<typename T >
static constexpr T Aleph::Add_Sum_Policy< T >::lazy_identity ( )
inlinestaticconstexprnoexcept

Definition at line 750 of file tpl_segment_tree.H.

◆ value_identity()

template<typename T >
static constexpr T Aleph::Add_Sum_Policy< T >::value_identity ( )
inlinestaticconstexprnoexcept

Definition at line 749 of file tpl_segment_tree.H.


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