| 806 | |
| 807 | template<bool StopAtMatch, typename KeyIter, typename Sentinel> |
| 808 | match_result extend_subsequence_impl( |
| 809 | match_result prev, KeyIter & first, Sentinel last) const |
| 810 | { |
| 811 | if (to_node_ptr(prev.node) == &header_) { |
| 812 | if (header_.empty()) |
| 813 | return prev; |
| 814 | prev.node = header_.child(0); |
| 815 | } |
| 816 | |
| 817 | if (first == last) { |
| 818 | prev.match = !!to_node_ptr(prev.node)->value(); |
| 819 | prev.leaf = to_node_ptr(prev.node)->empty(); |
| 820 | return prev; |
| 821 | } |
| 822 | |
| 823 | node_t const * node = to_node_ptr(prev.node); |
| 824 | size_type size = prev.size; |
| 825 | node_t const * last_match_node = nullptr; |
| 826 | size_type last_match_size = 0; |
| 827 | while (first != last) { |
| 828 | auto const it = node->find(*first, comp_); |
| 829 | if (it == node->end()) |
| 830 | break; |
| 831 | ++first; |
| 832 | ++size; |
| 833 | node = it->get(); |
| 834 | if (StopAtMatch && !!node->value()) { |
| 835 | last_match_node = node; |
| 836 | last_match_size = size; |
| 837 | } |
| 838 | } |
| 839 | if (StopAtMatch && last_match_node) { |
| 840 | node = last_match_node; |
| 841 | size = last_match_size; |
| 842 | } |
| 843 | |
| 844 | return match_result{node, size, !!node->value(), node->empty()}; |
| 845 | } |
| 846 | |
| 847 | template<typename KeyIter, typename Sentinel> |
| 848 | node_t * create_children(node_t * node, KeyIter first, Sentinel last) |