0
다음 코드의 동작을 이해하려고합니다.std :: regex_match의 결과가 잘못되었습니다.
결과가 나에게 잘못되어 있기 때문에 버그 일 수 있다고 생각합니다.
#include <iostream>
#include <regex>
int main(int ac, char **av)
{
std::regex reg("lib(.*)\\.so");
std::smatch match;
std::cout << std::regex_match(std::string("libscio.so"), match, reg) << std::endl;
std::cout << match.str(1) << std::endl;
return 0;
}
나는
1
scio
을 기대하고 있습니다 그러나 x86_64에 GNU/리눅스
에 GCC 버전 4.9.2 (데비안 4.9.2-10)로 컴파일 된 나에게1
ocio
을 제공합니다
[this] (http://stackoverflow.com/questions/33154890/simple-stdregex-search-code-wont-compile-with-apple-clang-std-c14)와 관련이 있습니다. – LogicStuff
어떤 표준 버전으로 컴파일하셨습니까? 이것을 응답하는 @ LogicStuff의 링크에서 알 수 있듯이 _rvalue_를 전달하는 것은 C++ 11에서 UB 였으므로 이제는 C++ 14에서 금지되었습니다. –