1

tr1/regex ライブラリを使用する場合、正規表現パターンをどのように定義すればよいですか?

#include <tr1/regex>

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

動作していません...コンパイル時にエラーが発生します:「正規表現」は型に名前を付けていません

4

1 に答える 1

3

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("[^-]-[^-]");
于 2011-01-17T18:19:51.287 に答える