Why do a C++ regular expression code that works with “cmatch” raises an exception with “smatch”?
问题 I am new to C++ regular expressions and cannot make them work with strings instead of char*. The examples I have seen so far were always for c strings. My real program, which I will not even try to show here, uses sub matches but I could not make them work, so I tried to modify a very simple working example but it does not work either. I use Visual Studio 2010 Ultimate. The original - working - code: const char *first = "abcd"; const char *last = first + strlen(first); std::cmatch mr; std: