| 56 | */ |
| 57 | template<typename Range1T, typename Range2T, typename PredicateT> |
| 58 | inline bool starts_with( |
| 59 | const Range1T& Input, |
| 60 | const Range2T& Test, |
| 61 | PredicateT Comp) |
| 62 | { |
| 63 | iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range1T>::type> lit_input(::boost::as_literal(Input)); |
| 64 | iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range2T>::type> lit_test(::boost::as_literal(Test)); |
| 65 | |
| 66 | typedef BOOST_STRING_TYPENAME |
| 67 | range_const_iterator<Range1T>::type Iterator1T; |
| 68 | typedef BOOST_STRING_TYPENAME |
| 69 | range_const_iterator<Range2T>::type Iterator2T; |
| 70 | |
| 71 | Iterator1T InputEnd=::boost::end(lit_input); |
| 72 | Iterator2T TestEnd=::boost::end(lit_test); |
| 73 | |
| 74 | Iterator1T it=::boost::begin(lit_input); |
| 75 | Iterator2T pit=::boost::begin(lit_test); |
| 76 | for(; |
| 77 | it!=InputEnd && pit!=TestEnd; |
| 78 | ++it,++pit) |
| 79 | { |
| 80 | if( !(Comp(*it,*pit)) ) |
| 81 | return false; |
| 82 | } |
| 83 | |
| 84 | return pit==TestEnd; |
| 85 | } |
| 86 | |
| 87 | //! 'Starts with' predicate |
| 88 | /*! |
no test coverage detected