简体   繁体   中英

tr/regex c++ library - definition of regex pattern

How should i define the regex pattern, when i use the tr1/regex library?

#include <tr1/regex>

const regex pattern("[^-]-[^-]");

is not working... When compiling i get error: 'regex' does not name a type

regex is in the tr1 namespace so you either need to declare that you are using tr1 or specify that regex is in the tr1 namespace:

using namespace tr1;

or

const tr1::regex pattern("[^-]-[^-]");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM