I am trying to map std::match_results data to my std::multimap variable. Here's the code:
int main()
{
...
auto begin = view.get();
auto end = begin + size.QuadPart;
auto logValues = multimap<char, double>{};
auto i = cregex_iterator{ begin, end, r };
int d = 0;
for (i; i != cregex_iterator{}; ++i, ++d);
for (auto e = 0; e < d; e++, ++i)
{
logValues.emplace((*i)[1], (*i)[4]);
}
TRACE(L"%d\n", d);
return 0;
}
I get the following error:
cannot convert argument 1 from 'const std::sub_match' to 'const char *const &'
I tried static_cast but it doesn't work. Do I need to write conversion operator to std::sub_match to convert first value to char or is there something I am missing?
Also, in my second for loop, I want to go through i which is std::cregex iterator, since it has been incremented while it was being filled up with data, how do I reset it to go through it again? or is that done automatically? I couldn't find answer to this in the documentation.
Aucun commentaire:
Enregistrer un commentaire