Hi, I am trying to use the 'find' function from the STL algorithms library on 'string' by using iterators only
(I am aware that string::find exists)
I am having trouble getting this to compile...any clues?
(This example should read the string and insert a '+' character before every '-' in the string "curr"
Code:
String curr = "aaa-bbb-ccc";
string::iterator plus = curr.begin();
while(plus != curr.end())
{
plus = find(plus,curr.end(),'-');
if(plus != curr.end())
{
curr.insert(plus,'+');
++plus;
}
}
any ideas?
Code:
q.cpp:19: error: no matching function for call to ‘find(__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, char)’
http://www.cplusplus.com/reference/algorithm/find/