Move skip_while helpers to selectors.hh

This commit is contained in:
Maxime Coste 2015-03-29 20:03:09 +01:00
parent 56b5300b9d
commit adaf6ecc40
2 changed files with 14 additions and 14 deletions

View File

@ -18,6 +18,20 @@ inline Selection keep_direction(Selection res, const Selection& ref)
return res; return res;
} }
template<typename Iterator, typename EndIterator, typename T>
void skip_while(Iterator& it, const EndIterator& end, T condition)
{
while (it != end and condition(*it))
++it;
}
template<typename Iterator, typename BeginIterator, typename T>
void skip_while_reverse(Iterator& it, const BeginIterator& begin, T condition)
{
while (it != begin and condition(*it))
--it;
}
using Utf8Iterator = utf8::iterator<BufferIterator, utf8::InvalidPolicy::Pass>; using Utf8Iterator = utf8::iterator<BufferIterator, utf8::InvalidPolicy::Pass>;
inline Selection utf8_range(const Utf8Iterator& first, const Utf8Iterator& last) inline Selection utf8_range(const Utf8Iterator& first, const Utf8Iterator& last)

View File

@ -78,20 +78,6 @@ private:
template<typename T> template<typename T>
T* Singleton<T>::ms_instance = nullptr; T* Singleton<T>::ms_instance = nullptr;
template<typename Iterator, typename EndIterator, typename T>
void skip_while(Iterator& it, const EndIterator& end, T condition)
{
while (it != end and condition(*it))
++it;
}
template<typename Iterator, typename BeginIterator, typename T>
void skip_while_reverse(Iterator& it, const BeginIterator& begin, T condition)
{
while (it != begin and condition(*it))
--it;
}
// *** On scope end *** // *** On scope end ***
// //
// on_scope_end provides a way to register some code to be // on_scope_end provides a way to register some code to be