Visual Studio Ultimate 2012에서 다음 코드를 컴파일하려고합니다. 오류가 발생하여 해당 함수에 대해 존재하지 않는 오버로드를 호출하고 있습니다. regex_search() 템플릿. std :: regex_search()가 내 인수를 허용하지 않습니다.
#include <regex>
struct Token
{
//lexertl token wrapper...
};
class Lexer
{
//...
Token &curr;
bool skipUntil(const std::regex ®exp);
};
bool Lexer::skipUntil(const std::regex ®exp)
{
std::smatch m;
const char *str = curr.results.start._Ptr; //compiles
//ERROR ON NEXT LINE (overload doesn't exist, but it should...)
if(std::regex_search(str, regexp, m)) {
curr.results.start = m[0].first;
curr.results.end = curr.results.start;
}
}
이
은//from <regex>
template <class charT, class Alloc, class traits>
bool regex_search (const charT* s, match_results<const charT*, Alloc>& m,
const basic_regex<charT,traits>& rgx,
regex_constants::match_flag_type flags = regex_constants::match_default);
내가 쉽게 수정 그냥 const를 문자로 변환하는 것입니다 알고 ... 나는 지금까지 내가 말할 수있는 존재하는, 사용하기 위해 노력하고있어 템플릿입니다 * std :: string으로 변환 할 수 있지만 너무 비싸서 조작 할 필요가 없습니다.
cmatch가 내 문제를 해결 한 것 같습니다! 잠시 후 대답으로 표시하거나 ... – ffhighwind
_Ptr은 약간의 iffy입니다. 그것은 Visual Studio 또는 lexertl에만 국한된 표현인지 확실하지 않습니다. 나는 모든 반복기가 VS에 _Ptr을 가지고 있다고 믿는다. – ffhighwind
@ffhighwind iterator 인 경우 명확하게 구현 세부 사항입니다. 선행 밑줄 뒤에 대문자가 오는 표준 라이브러리의 내용은 일반인을 대상으로하지 않습니다. '& (* curr.results.start) '를 사용하여 기본 포인터에 액세스 할 수 있어야합니다. – Praetorian