Skip to content

Commit dcec570

Browse files
committed
Split AL functionality into separate class.
1 parent 2b5f330 commit dcec570

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

include/boost/algorithm/searching/musser_nishanov.hpp

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,8 @@ namespace boost { namespace algorithm {
2525
template <typename PatIter, typename CorpusIter = PatIter, typename Trait = search_trait<typename std::iterator_traits<PatIter>::value_type>, typename Enable = void>
2626
class musser_nishanov;
2727

28-
/**
29-
* Musser-Nishanov Accelerated Linear search algorithm.
30-
*/
31-
template <typename PatIter, typename CorpusIter, typename Trait>
32-
class musser_nishanov<PatIter, CorpusIter, Trait,
33-
typename disable_if<
34-
typename boost::mpl::and_<
35-
boost::is_base_of<std::random_access_iterator_tag, typename std::iterator_traits<CorpusIter>::iterator_category>,
36-
boost::mpl::bool_<Trait::suffix_size>
37-
>::type
38-
>::type>
28+
template <typename PatIter, typename CorpusIter = PatIter, typename Trait = search_trait<typename std::iterator_traits<PatIter>::value_type> >
29+
class accelerated_linear
3930
{
4031
BOOST_STATIC_ASSERT (( boost::is_same<
4132
typename std::iterator_traits<PatIter>::value_type,
@@ -132,7 +123,7 @@ typename disable_if<
132123
}
133124

134125
public:
135-
musser_nishanov(PatIter pat_first, PatIter pat_last) : pat_first(pat_first), pat_last(pat_last), k_pattern_length(std::distance(pat_first, pat_last))
126+
accelerated_linear(PatIter pat_first, PatIter pat_last) : pat_first(pat_first), pat_last(pat_last), k_pattern_length(std::distance(pat_first, pat_last))
136127
{
137128
if (k_pattern_length > 0)
138129
compute_next();
@@ -149,6 +140,23 @@ typename disable_if<
149140
};
150141

151142

143+
/**
144+
* Musser-Nishanov Accelerated Linear search algorithm.
145+
*/
146+
template <typename PatIter, typename CorpusIter, typename Trait>
147+
class musser_nishanov<PatIter, CorpusIter, Trait,
148+
typename disable_if<
149+
typename boost::mpl::and_<
150+
boost::is_base_of<std::random_access_iterator_tag, typename std::iterator_traits<CorpusIter>::iterator_category>,
151+
boost::mpl::bool_<Trait::suffix_size>
152+
>::type
153+
>::type> : public accelerated_linear<PatIter, CorpusIter, Trait>
154+
{
155+
public:
156+
musser_nishanov(PatIter pat_first, PatIter pat_last) : accelerated_linear<PatIter, CorpusIter, Trait>(pat_first, pat_last) {}
157+
};
158+
159+
152160
/**
153161
* Musser-Nishanov Hashed Accelerated Linear search algorithm.
154162
*/

0 commit comments

Comments
 (0)