numeric
Public Types | Public Member Functions | List of all members
numeric::Combination< T > Class Template Reference

Combination of a unique item map Binomialcoefficient (n k) More...

#include <Combinatorics.hpp>

Public Types

typedef std::vector< T > ItemList
 

Public Member Functions

 Combination (const std::vector< T > &uniqueItems, size_t sizeOfDraw, Mode mode=EXACT)
 Combination of a unique item map Binomialcoefficient (n k) More...
 
void createStartDraw (uint32_t n, uint32_t k)
 
bool next ()
 
ItemList current () const
 
uint64_t numberOfCombinations () const
 

Detailed Description

template<class T>
class numeric::Combination< T >

Combination of a unique item map Binomialcoefficient (n k)

Template Parameters
Typeof items that should be combined

A code example

  #include <vector>
  #include <string>
  #include <numeric/Combinatorics.hpp>

  using namespace numerics;

  ...

  std::vector<std::string> items;
  items.push_back("A");
  items.push_back("B");
  items.push_back("C");

  Combination<std::string> combinations(items, EXACT);
  do {
      std::vector<std::string> combination = combinations.current();
      ...
  } while(combinations.next());

Member Typedef Documentation

◆ ItemList

template<class T >
typedef std::vector<T> numeric::Combination< T >::ItemList

Constructor & Destructor Documentation

◆ Combination()

template<class T >
numeric::Combination< T >::Combination ( const std::vector< T > &  uniqueItems,
size_t  sizeOfDraw,
Mode  mode = EXACT 
)
inline

Combination of a unique item map Binomialcoefficient (n k)

Parameters
uniqueItemsMap of unique items
sizeOfDrawSize of the draw (k)
modeOne of Mode to get the exact type of combination all up to (MAX) or from to maximum use (MIN)

Member Function Documentation

◆ createStartDraw()

template<class T >
void numeric::Combination< T >::createStartDraw ( uint32_t  n,
uint32_t  k 
)
inline

◆ current()

template<class T >
ItemList numeric::Combination< T >::current ( ) const
inline

◆ next()

template<class T >
bool numeric::Combination< T >::next ( )
inline

◆ numberOfCombinations()

template<class T >
uint64_t numeric::Combination< T >::numberOfCombinations ( ) const
inline

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