16 #include <type_traits> 49 template <
bool abort_on_hit,
typename query_t,
typename cursor_t,
typename delegate_t>
50 inline bool search_trivial(cursor_t cur, query_t & query,
typename cursor_t::size_type
const query_pos,
51 search_param
const error_left, delegate_t && delegate) noexcept(noexcept(delegate))
67 if (error_left.insertion > 0)
69 search_param error_left2{error_left};
70 error_left2.insertion--;
75 if (search_trivial<abort_on_hit>(cur, query, query_pos + 1, error_left2, delegate) && abort_on_hit)
80 if (((query_pos > 0 && error_left.deletion > 0) || error_left.substitution > 0) && cur.extend_right())
85 if (error_left.substitution > 0)
87 bool delta = cur.last_rank() !=
to_rank(query[query_pos]);
88 search_param error_left2{error_left};
89 error_left2.total -= delta;
90 error_left2.substitution -= delta;
92 if (search_trivial<abort_on_hit>(cur, query, query_pos + 1, error_left2, delegate) && abort_on_hit)
100 if (error_left.substitution == 0 && cur.last_rank() ==
to_rank(query[query_pos]))
102 if (search_trivial<abort_on_hit>(cur, query, query_pos + 1, error_left, delegate) &&
112 if (error_left.deletion > 0)
114 search_param error_left2{error_left};
116 error_left2.deletion--;
118 if (search_trivial<abort_on_hit>(cur, query, query_pos, error_left2, delegate) && abort_on_hit)
122 }
while (cur.cycle_back());
127 if (cur.extend_right(query[query_pos]))
129 if (search_trivial<abort_on_hit>(cur, query, query_pos + 1, error_left, delegate) && abort_on_hit)
156 template <
bool abort_on_hit,
typename index_t,
typename query_t,
typename delegate_t>
157 inline void search_trivial(index_t
const & index, query_t & query, search_param
const error_left,
158 delegate_t && delegate) noexcept(noexcept(delegate))
160 search_trivial<abort_on_hit>(index.begin(), query, 0, error_left, delegate);
constexpr auto to_rank
Return the rank representation of a (semi-)alphabet object.
Definition: concept.hpp:103
constexpr auto drop
A view adaptor that returns all elements after n from the underlying range (or an empty range if the ...
Definition: drop.hpp:171
::ranges::size size
Alias for ranges::size. Obtains the size of a range whose size can be calculated in constant time...
Definition: ranges:189
Additional non-standard concepts for ranges.
Adaptations of concepts from the Ranges TS.
Definition: aligned_sequence_concept.hpp:35
Provides data structures used by different search algorithms.