/*============================================================================= Copyright (c) 2011-2019 Bolero MURAKAMI https://github.com/bolero-MURAKAMI/Sprout Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #ifndef TOOLS_SPRIG_ALGORITHM_STRING_FIND_BETWEEN_HPP #define TOOLS_SPRIG_ALGORITHM_STRING_FIND_BETWEEN_HPP #include #include #include #include namespace sprig { // // between_finder // template struct between_finderF { private: Finder1 finder1_; Finder2 finder2_; public: between_finderF(Finder1 const& finder1, Finder2 const& finder2) : finder1_(finder1), finder2_(finder2) {} template boost::iterator_range operator()(ForwardIterator first, ForwardIterator last) const { first = boost::end(finder1_(first, last)); return boost::iterator_range(first, boost::begin(finder2_(first, last))); } }; template inline sprig::between_finderF between_finder(Finder1 const& finder1, Finder2 const& finder2) { return sprig::between_finderF(finder1, finder2); } // // find_between // template inline boost::iterator_range::type> find_between(Range& input, Finder1 const& finder1, Finder2 const& finder2) { return boost::algorithm::find(input, sprig::between_finder(finder1, finder2)); } } // namespace sprig #endif // #ifndef TOOLS_SPRIG_ALGORITHM_STRING_FIND_BETWEEN_HPP