Let m be of type std::smatch . Suppose there is an unmatched group i. What is
m.position(i) ? For that matter, what is m[i]?
For example, consider
std::regex re {"^(a+)|(b+)"};
string target="aa";
std::smatch m;
std::regex_search(target,m,re);
cout<<"m[2] is: "<<m[2]<<" at position: "<<m.position(2);
I cannot figure out from the reference https://en.cppreference.com/w/cpp/regex/match_results/position what is guaranteed to happen here and why.