用于以下代码:
#include#include using namespace std; int main(int argc, char *argv[]) { regex reg("/"); string s = "Split/Values/Separated/By/Slashes"; sregex_token_iterator it{std::begin(s), std::end(s), reg, -1}; sregex_token_iterator end; while(it != end) { cout << *it++ << endl; } return 0; }
应该输出:
Split Values Separated By Slashes
但它输出这个:
Values Separated By Slashes
主要代码可能是问题*it++
,如果我写cout << *it << endl;++it;
,它的工作正常.
当我将stand c ++ 11 regex更改为boost-regex时,*it++
也正常工作.
我检查了正则表达式的头部,我认为该operator++(int)
函数没有问题.
我的铿锵版是
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn) Target: x86_64-apple-darwin13.0.0 Thread model: posix
有人有这样的问题吗?
clang中有错误吗?