9#include <boost/iterator/transform_iterator.hpp>
17 return std::find_if(std::next(subtreeBegin), regionEnd, [subtreeRootDepth](
Row const &row) ->
bool {
18 return row.
location().depth() == subtreeRootDepth;
24 auto subtree = std::vector<Row>();
25 subtree.reserve(std::distance(subtreeBegin, subtreeEnd));
26 std::transform(subtreeBegin, subtreeEnd, std::back_inserter(subtree), [&subtreeRootLocation](
Row const &row) ->
Row {
33 auto subtrees = std::vector<Subtree>();
34 auto current = rows.cbegin();
35 while (current != rows.cend()) {
36 auto subtreeRootLocation = (*current).location();
37 auto subtreeBegin = current;
38 auto subtreeEnd =
findEndOfSubtree(subtreeBegin, rows.cend(), subtreeRootDepth);
48 std::sort(region.begin(), region.end());
49 if (!region.empty()) {
51 auto rowLocationBegin = boost::make_transform_iterator(region.cbegin(), &
rowToRowLocation);
52 auto rowLocationEnd = boost::make_transform_iterator(region.cend(), &
rowToRowLocation);
55 return makeSubtreesFromRows(region, subtreeRootDepth);
59 return std::vector<Subtree>();