Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::MoPolicy Concept Reference

Concept constraining a policy for Mo's algorithm. More...

#include <tpl_mo_algorithm.H>

Concept definition

template<typename P, typename T>
concept Aleph::MoPolicy = requires(P & p, const Array<T> & data,
size_t idx, size_t n)
{
typename P::answer_type;
{ p.init(data, n) };
{ p.add(data, idx) };
{ p.remove(data, idx) };
{ p.answer() } -> std::convertible_to<typename P::answer_type>;
}
Simple dynamic array with automatic resizing and functional operations.
Definition tpl_array.H:139
Concept constraining a policy for Mo's algorithm.
pair< size_t, string > P

Detailed Description

Concept constraining a policy for Mo's algorithm.

A valid MoPolicy must provide:

  • answer_type — the result type for a single query.
  • init(data, n) — reset internal state before the sweep.
  • add(data, idx) — expand the current window to include data(idx).
  • remove(data, idx) — shrink the current window by removing data(idx).
  • answer() — return the answer for the current window.
Template Parameters
PPolicy type.
TElement type of the data array.

Definition at line 103 of file tpl_mo_algorithm.H.