My project failed to build if I use std::find in a code . The error I got are the followings
usr/include/c++/4.6/bits/stl_algo.h:162:4: error: no match for ‘operator==’ in ‘_first._gnu_cxx::__normal_iterator<_Iterator, _Container>::operator* with _Iterator = char*, _Container = std::basic_string, __gnu_cxx::__normal_iterator<_Iterator, _Container>::reference = char& == __val’ /usr/include/c++/4.6/bits/stl_algo.h:162:4: note: candidates are:
Below are my code ..
std::string lValueCmd = "";
std::string lModeType = "";
std::string lAPModeCmd = "sudo iwconfig /sbin/wlan0 | grep -i 'Mode:' | awk '{print $1}'";
// function to retrive values from linux command and store it in lValueCmd
lResult = RequestCmdOutput( lAPModeCmd, lValueCmd ) ; // function to retrive values from linux command and store it in lValue Cmdd
// std::cout << " the string is " << lValueCmd << std::endl;// debug
std::string delimiter= ":";
std::string::iterator pos;
pos= std::find( lValueCmd.begin(), lValueCmd.end(), delimiter); // no error if I comment this line.
The Header files , I have used are iostream , algorithm and string .
std::string::find()
unless you really need to return an iterator (which is not usually the case working withstd::string
). – Gorpik