sashoalm
sashoalm

Reputation: 79665

Problems using tr1::regex with unicode strings

    std::wstring str(L"something");
    std::tr1::wregex rx(L"something");
    std::tr1::wcmatch res;
    std::tr1::regex_search(str, res, rx);       

This fails to compile with the error:

error C2784: 'bool std::tr1::regex_search(const std::basic_string<_Elem,_StTraits,_StAlloc> &,const std::tr1::basic_regex<_Elem,_RxTraits> &,std::tr1::regex_constants::match_flag_type)' : could not deduce template argument for 'const std::tr1::basic_regex<_Elem,_RxTraits> &' from 'std::tr1::wcmatch'

Upvotes: 1

Views: 2153

Answers (1)

ymett
ymett

Reputation: 2454

You should be using wsmatch, which is for wstring iterators, not wcmatch, which is for wchar_t*.

Upvotes: 3

Related Questions