todo: name?
| 87 | // Converts the sequence into a tree considering the given binary predicate. |
| 88 | template <typename BinaryPredicate, typename Container> // todo: name? |
| 89 | std::vector<tree<typename Container::value_type>> trees_from_sequence( |
| 90 | BinaryPredicate is_child_of, const Container& xs) |
| 91 | { |
| 92 | internal::check_binary_predicate_for_container<BinaryPredicate, Container>(); |
| 93 | typedef typename Container::value_type T; |
| 94 | typedef tree<T> Tree; |
| 95 | const auto singletons = transform_convert<std::vector<Tree>>( |
| 96 | internal::make_singleton_tree<T>, xs); |
| 97 | const auto tree_is_child_of = |
| 98 | [is_child_of](const tree<T>& a, const tree<T>& b) -> bool { |
| 99 | return is_child_of(a.value_, b.value_); |
| 100 | }; |
| 101 | return internal::trees_from_sequence_helper( |
| 102 | tree_is_child_of, std::move(singletons)); |
| 103 | } |
| 104 | |
| 105 | namespace internal { |
| 106 |
no test coverage detected