Data structure for partially ordered sets with support for gradual ordering discovery.
More...
|
| template<typename Container > |
| | Poset (const Container &container) |
| | Container constructor. More...
|
| |
| template<typename Iter > |
| | Poset (Iter &&begin, Iter &&end) |
| | Range constructor. More...
|
| |
| template<typename Iter > |
| void | setUnorderedValues (Iter &&begin, Iter &&end) |
| | Sets the values in the specified range as the only unordered Subset. More...
|
| |
| template<typename Comparator > |
| void | orderUnordered (Comparator &&comparator) |
| | Adds order to unordered Subsets. More...
|
| |
| void | finalize () |
| | Sets all subsets as ordered. More...
|
| |
|
const_iterator | begin () const |
| |
|
const_iterator | end () const |
| |
| std::string | toString () const |
| | Convert the Poset to a string representation for debug purposes. More...
|
| |
| const_iterator | find (const T &a) const |
| | Find an element. More...
|
| |
| boost::tribool | compare (const T &a, const T &b) const |
| | Less-than compare two elements in the poset. More...
|
| |
|
std::vector< std::vector< T > > | extract () |
| | Extracts the contained order, moving from each contained subset and clearing the Poset.
|
| |
template<typename T>
class Scine::Molassembler::Temple::Poset< T >
Data structure for partially ordered sets with support for gradual ordering discovery.
If ordering of values is a complicated, emergent matter, this class can help you manage the mess and minimize the number of comparisons needed to establish ordering between values.
std::vector<int> values {4, 5, 6, 10, 11, 12};
Poset<int> poset {values};
poset.orderUnordered([](int x, int y) { return (x % 2 == 0) > (y % 2 == 0); });
poset.orderUnordered(std::greater<>());
- Note
- This class would probably benefit immensely from a pool allocator.