huc::combinatory Namespace Reference
Functions | |
template<typename Container , typename IT > | |
std::list< Container > | Combinations (const IT &begin, const IT &end) |
template<typename Container , typename IT > | |
Container | Intersection (const IT &beginFirst, const IT &endFirst, const IT &beginSecond, const IT &endSecond) |
template<typename IT > | |
bool | IsInterleaved (const IT &beginFirst, const IT &endFirst, const IT &beginSecond, const IT &endSecond, const IT &beginFull, const IT &endFull) |
template<typename Container , typename IT > | |
std::list< Container > | Permutations (const IT &begin, const IT &end) |
Function Documentation
template<typename Container , typename IT >
std::list<Container> huc::combinatory::Combinations | ( | const IT & | begin, |
const IT & | end | ||
) |
Combinations - Return all possible combinations of elements containing within the sequence.
- Remarks
- a vector is not recommended as type for the Output_Container to avoid stack overflow as well as extra complexity due to frequent resizing (use instead structure such as list or a another with your own allocator).
- Template Parameters
-
Container type of IT type. IT type using to go through the collection.
- Parameters
-
begin,end - iterators to the initial and final positions of the sequence. The range used is [first,last), which contains all the elements between first and last, including the element pointed by first but not the element pointed by last.
- Returns
- a collection containing all possible combined subsets.
Definition at line 45 of file combinations.hxx.
template<typename Container , typename IT >
Container huc::combinatory::Intersection | ( | const IT & | beginFirst, |
const IT & | endFirst, | ||
const IT & | beginSecond, | ||
const IT & | endSecond | ||
) |
Intersection - Return Intersection of the two sequences.
- Remarks
- Retrieve the intersection of two sequences keeping dupplicate keys distinct.
- Template Parameters
-
IT type using to go through the collection.
- Parameters
-
beginFirst,endFirst,beginSecond,endSecond - iterators to the initial and final positions of the sequences. The range used is [first,last), which contains all the elements between first and last, including the element pointed by first but not the element pointed by last.
- Returns
- a vector containing the intersection of both sequences.
Definition at line 42 of file intersection.hxx.
template<typename IT >
bool huc::combinatory::IsInterleaved | ( | const IT & | beginFirst, |
const IT & | endFirst, | ||
const IT & | beginSecond, | ||
const IT & | endSecond, | ||
const IT & | beginFull, | ||
const IT & | endFull | ||
) |
IsInterleaved - Return whether or not if a sequence is the interleave of the two others.
- Template Parameters
-
IT type using to go through the collection.
- Parameters
-
beginFirst,endFirst,beginSecond,endSecond,beginFull,endFull - iterators to the initial and final positions of the sequences. The range used is [first,last), which contains all the elements between first and last, including the element pointed by first but not the element pointed by last.
- Returns
- true if the last sequence is the interleave of the two others, false otherwise.
Definition at line 40 of file is_interleaved.hxx.
template<typename Container , typename IT >
std::list<Container> huc::combinatory::Permutations | ( | const IT & | begin, |
const IT & | end | ||
) |
Permutations - Return all possible permutations of elements containing within the sequence (n!).
- Remarks
- a vector is not recommended as type for the Output_Container to avoid stack overflow as well as extra complexity due to frequent resizing (use instead structure such as list or a another with your own allocator).
- Template Parameters
-
IT type using to go through the collection.
- Parameters
-
begin,end - iterators to the initial and final positions of the sequence. The range used is [first,last), which contains all the elements between first and last, including the element pointed by first but not the element pointed by last.
- Returns
- a collection containing all possible permuted sequences.
Definition at line 44 of file permutations.hxx.