stlab 2.3.0
Modern, modular C++ algorithms, data structures, and concurrency primitives
Loading...
Searching...
No Matches
stlab::forests Namespace Reference

Classes

struct  transcribe_iterator
 Output iterator that inserts projected values into a forest (or similar container). More...

Functions

template<class Forest1, class Forest2>
auto equal_shape (const Forest1 &x, const Forest2 &y) -> bool
 Returns true if x and y have the same full-order edge sequence (values may differ).
template<class Container>
auto transcriber (Container &c)
 Returns a transcribe_iterator starting at c.begin() for building c from a walk.
template<class I, class O, class P, class UP>
auto transcribe (I first, const I &last, O out, P proj, UP pred)
 Walks [first, last); for positions where pred is true, assigns proj(*first) to out, otherwise calls out.trailing().
template<class R, class O, class P, class UP>
auto transcribe (const R &range, O out, P proj, UP pred)
 Range overload of transcribe with explicit leading/trailing predicate pred.
template<class I, class O, class P>
auto transcribe (const I &first, const I &last, O out, P proj)
 Walks [first, last) using is_leading as the predicate (default transcribe behavior).
template<class R, class O, class P>
auto transcribe (const R &range, O out, P proj)
 Range overload of transcribe with is_leading as the predicate.
template<class I, class O>
auto flatten (I first, const I &last, O out)
 Writes each leading node's value to out; writes std::nullopt at trailing edges.
template<class I, class F>
auto unflatten (I first, I last, F &f)
 Rebuilds forest f from a flattened std::optional sequence (inverse of flatten).