Hello to all, i want to search a container which copied from file with certain regular expression and then display it to stdout;
Here is my code:
[code]
std::cout << "\n\nEnter Search designation : ";
std::string userDesignation;
getline(std::cin, userDesignation);
std::ifstream inHandle("C:\\Staff.txt");
std::vector<std::string> data;
data.reserve(100);
std::copy(std::istream_iterator<std::string>(inHandle),
std::istream_iterator<std::string>(),
std::back_inserter(data) );
boost::regex searchExpression(userDesignation);
boost::match_results<std::vector<std::string>::iterator > result;
boost::regex_match(data.begin(), data.end(), result, searchExpression);
[/code]
The error is
error C2664: 'char boost::w32_regex_traits<charT>::translate(charT,bool) const' : cannot convert parameter 1 from 'std::basic_string<_Elem,_Traits,_Ax>' to 'char'
error C2664: 'char boost::w32_regex_traits<charT>::translate(charT,bool) const' : cannot convert parameter 1 from 'std::basic_string<_Elem,_Traits,_Ax>' to 'char'
I think the error cause by vector string iterator rather than string iterator.
Any workaround solution to this problem ?
Thanks.
--
Linux