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)’
C++ vector does not have a find member function. However, the algorithm library has a find() function of different types that can be used to find something in a C++ vector. The algorithm library has four groups of find() functions that can be classified as Find, Find End, Find First, and Adjacent Find.
unsigned char is a character datatype where the variable consumes all the 8 bits of the memory and there is no sign bit (which is there in signed char). So it means that the range of unsigned char data type ranges from 0 to 255.
unsigned char ch = 'n'; Both of the Signed and Unsigned char, they are of 8-bits. So for signed char it can store value from -128 to +127, and the unsigned char will store 0 to 255.
In C, unsigned char is the only type guaranteed to have no trapping values, and which guarantees copying will result in an exact bitwise image. (C++ extends this guarantee to char as well.) For this reason, it is traditionally used for "raw memory" (e.g. the semantics of memcpy are defined in terms of unsigned char ).
Are you including <algorithm>
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With