I have a problem with the string_algo split_iterator.
Background is that I have a function that finds a string in a range of other
strings.
template
inline unsigned int find_first_in_range(const CollectionT& Input, const
RangeT& Search, PredicateT Comp) {
typename boost::range_const_iterator<RangeT>::type
first = boost::begin(Search),
last = boost::end(Search);
for (unsigned int index = 1; first != last; ++first, ++index)
if (Comp(Input, *first)) return index;
return 0;
}
This function works fine if I send in a std::vector like
std::vectorstd::string vec;
vec.push_back("Item1"); vec.push_back("Item2");
find_first_in_range(std::string("Item2"), vec, equals_pred());
equals_pred is just a functor version of the equals predicate that don't
require the template arguments
struct equals_pred {
template
bool operator()(const T1& arg1, const T2& arg2) const { return boost::equals
(arg1, arg2); }
};
But if I do the same thing with the split_iterator
find_first_in_range(
std::string("item2"),
make_split_iterator(
std::string("Item1,Item2,Item3,Item4"), first_finder(",")
),
iequals_pred()
);
I get an error (VC70)
boost\range\detail\const_iterator.hpp(34) : error C2039: 'const_iterator' : is
not a member of 'boost::algorithm::split_iterator<IteratorT>'
with
[
IteratorT=boost::range_result_iterator,std::allocator<char>>>::type
]
boost\range\detail\const_iterator.hpp(118) : see reference to class template
instantiation 'boost::range_detail::range_const_iterator_<T>::pts<C>' being
compiled
with
[
T=boost::range_detail::std_container_,
C=boost::algorithm::split_iterator>::type>
]