Search code examples
c++vectorfindcharunsigned

c++ find char in vector of unsigned chars


I have the problem with the following code:

message is vector<unsigned char>

vector<unsigned char>::iterator pos = message.begin();
vector<unsigned char>::iterator start = message.begin();
vector<unsigned char>::iterator end = message.end();

pos = find(start, end, ' ');

I got the error:

error: no matching function for call to ‘find(std::vector<unsigned char>::iterator&, std::vector<unsigned char>::iterator&, char)’

Solution

  • Are you including <algorithm>?