Mackey  V3.3
A C++ library for computing RO(G) graded homology
FactoryGenerator< spec_t, gen_t > Class Template Reference

Prototype for coroutine-like iterators that generate elements such as combinations. More...

#include <Generators.hpp>

Inheritance diagram for FactoryGenerator< spec_t, gen_t >:
[legend]

Public Member Functions

const gen_toperator* () const
 Returns the generated element. More...
 
bool operator!= (const FactoryGenerator &other) const
 Inequality of iterators (used to detect if generation has been completed) More...
 
spec_t & operator++ ()
 Generates next element. More...
 

Static Public Member Functions

static spec_t end ()
 Terminal iterator. More...
 

Protected Attributes

bool completed
 1 if the iterator is end() i.e. if all elements have been generated More...
 
gen_t generated
 The currently generated element. More...
 

Detailed Description

template<class spec_t, class gen_t>
class mackey::FactoryGenerator< spec_t, gen_t >

Prototype for coroutine-like iterators that generate elements such as combinations.

Inherit from this class and define a method update() to get a const iterator.
You will also need begin() and end() methods returning such iterators; end() should always be defined by calling the factory end() .
Example implementations: CombinationGenerator and PermutationGenerator

Attention
Probably not thread-safe (depends on specialization's update() method).
Todo:
Implement as coroutine (C++20)
Template Parameters
spec_tUsed for compile-time polymorphism (CRTP): set it to be the child class.
gen_tThe type of the generated element.

Member Function Documentation

◆ operator*()

const gen_t& operator* ( ) const

Returns the generated element.

◆ operator!=()

bool operator!= ( const FactoryGenerator< spec_t, gen_t > &  other) const

Inequality of iterators (used to detect if generation has been completed)

◆ operator++()

spec_t& operator++ ( )

Generates next element.

◆ end()

static spec_t end ( )
static

Terminal iterator.

Member Data Documentation

◆ completed

bool completed
protected

1 if the iterator is end() i.e. if all elements have been generated

◆ generated

gen_t generated
protected

The currently generated element.


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