EllAlgo 1.6.13
Loading...
Searching...
No Matches
Public Member Functions | List of all members
RoundRobin Class Reference

Round-robin index generator over a half-open range [lo, hi) More...

#include <round_robin.hpp>

Public Member Functions

 RoundRobin ()
 Default-construct (uninitialized; reassign before use)
 
 RoundRobin (std::size_t hi)
 Round-robin over [0, hi)
 
 RoundRobin (std::size_t lo, std::size_t hi)
 Round-robin over [lo, hi)
 
auto next () -> std::size_t
 Advance to the next index and return it.
 

Detailed Description

Round-robin index generator over a half-open range [lo, hi)

Successive calls to next() yield lo, lo+1, ..., hi-1, lo, ... Used to scan constraints cyclically (e.g. ProfitOracle, LowpassOracle). The first call to next() returns lo, matching the ++idx; if (idx == N) idx = 0; idiom it replaces.

Constructor & Destructor Documentation

◆ RoundRobin() [1/3]

RoundRobin::RoundRobin ( )
inline

Default-construct (uninitialized; reassign before use)

◆ RoundRobin() [2/3]

RoundRobin::RoundRobin ( std::size_t  hi)
inlineexplicit

Round-robin over [0, hi)

◆ RoundRobin() [3/3]

RoundRobin::RoundRobin ( std::size_t  lo,
std::size_t  hi 
)
inline

Round-robin over [lo, hi)

Member Function Documentation

◆ next()

auto RoundRobin::next ( ) -> std::size_t
inline

Advance to the next index and return it.


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