no matching function for call to ‘regex_search(…)'

前端 未结 1 2043
深忆病人
深忆病人 2020-12-19 04:16

Given an old-style const char * pointer and a length, is there a way to call std::regex_search() on it without first copying the contents of the bu

相关标签:
1条回答
  • 2020-12-19 05:06

    The error in your code is that you're using the wrong match_results type. smatch is supposed to be used when you have an std::string object and you're passing std::string::iterators to the regex function. When you have raw char const *s use cmatch instead.

    Change

    std::smatch what;
    

    to

    std::cmatch what;
    

    Live demo

    0 讨论(0)
提交回复
热议问题