Opened 10 years ago
Closed 10 years ago
#8208 closed Bugs (worksforme)
param of xpressive::sregex_iterator compiler error in VS2012
| Reported by: | Owned by: | Eric Niebler | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | xpressive |
| Version: | Boost 1.53.0 | Severity: | Problem |
| Keywords: | Cc: |
Description
Windows7 64bit, MS Visual Studio 2012 (VC11), build with 32bit;
I just compiler example code in user's guide, "Find all the sub-strings that match a regex and step through them one at a time" :
std::wstring str( L"This is his face." ); wsregex token = +alnum; wsregex_iterator cur( str.begin(), str.end(), token ); <---error wsregex_iterator end;
for( ; cur != end; ++cur ) {
wsmatch const &what = *cur; std::wcout << what[0] << L'\n';
}
compiler said undeclared identifier of "token" in "wsregex_iterator cur( str.begin(), str.end(), token );" !!!
I changed the var "token" to "tt_k", it report same error still. The sample code compiler OK in VS2010, but fail in VS2012.

I copied the code exactly as it is from that example, pasted it into a brand new VS2012 project, hit compile, and it worked. For reference, the code is here:
#include <iostream> #include <boost/xpressive/xpressive.hpp> using namespace boost::xpressive; int main() { std::wstring str( L"This is his face." ); // find a whole word wsregex token = +alnum; wsregex_iterator cur( str.begin(), str.end(), token ); wsregex_iterator end; for( ; cur != end; ++cur ) { wsmatch const &what = *cur; std::wcout << what[0] << L'\n'; } return 0; }