Project Euler Solutions
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
c::include::iterator::counter Struct Reference

The reference struct for all iterators in this project. More...

#include <iterator.h>

Inheritance diagram for c::include::iterator::counter:
Inheritance graph
[legend]
Collaboration diagram for c::include::iterator::counter:
Collaboration graph
[legend]

Public Member Functions

counter count_by (uintmax_t start, uintmax_t stop, intmax_t step)
 The base constructor for the counter iterator. More...
 
counter count_in_range (uintmax_t start, uintmax_t stop)
 The simpler constructor for the counter iterator. More...
 
counter count_to (uintmax_t stop)
 The simplest constructor for the counter iterator. More...
 

Public Attributes

uintmax_t idx
 The current position of the counter. More...
 
uintmax_t stop
 The value before which the counter will stop. More...
 
intmax_t step
 The amount by which the counter will move. More...
 
- Public Attributes inherited from c::include::iterator::Iterator
bool exhausted: 1
 An indicator that the iterator has stopped. More...
 
bool started: 1
 An indicator that the iterator has started. More...
 
bool phase: 1
 An indicator that changes each time the iterator moves. More...
 

Private Member Functions

static uintmax_t iterate_counter (counter *i)
 The function to advance a counter. More...
 

Private Attributes

uintmax_t(*const iterator_function )(counter *it)
 The pointer to the iteration function. More...
 
void(*const destructor )(void *it)
 The pointer to the destructor function. More...
 

Additional Inherited Members

Detailed Description

The reference struct for all iterators in this project.

Member Function Documentation

counter count_by ( uintmax_t  start,
uintmax_t  stop,
intmax_t  step 
)

The base constructor for the counter iterator.

Parameters
startThe beginning position of the counter
stopThe point where the counter is exhausted
stepThe amount to step by each time you iterate the counter
Returns
A counter
counter count_in_range ( uintmax_t  start,
uintmax_t  stop 
)

The simpler constructor for the counter iterator.

Parameters
startThe beginning position of the counter
stopThe point where the counter is exhausted
Returns
A counter
counter count_to ( uintmax_t  stop)

The simplest constructor for the counter iterator.

Parameters
stopThe point where the counter is exhausted
Returns
A counter
static uintmax_t iterate_counter ( counter i)
private

The function to advance a counter.

Parameters
ithe counter you want to advance
Returns
the next number in the iteration

Member Data Documentation

void(*const c::include::iterator::counter::destructor) (void *it)
private

The pointer to the destructor function.

See also
free_iterator
uintmax_t c::include::iterator::counter::idx

The current position of the counter.

uintmax_t(*const c::include::iterator::counter::iterator_function) (counter *it)
private

The pointer to the iteration function.

See also
next
intmax_t c::include::iterator::counter::step

The amount by which the counter will move.

uintmax_t c::include::iterator::counter::stop

The value before which the counter will stop.


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