- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Consider the code in this example:
test.cpp
This code compiles/run fine on GCC 4.6.2, but on ICC 12.1.0e, I get the following error:
Consider the code in this example:
test.cpp
This code compiles/run fine on GCC 4.6.2, but on ICC 12.1.0e, I get the following error:
$ icpc test.cpp
test.cpp(22): error: expected an expression
for_each(idx.begin(), idx.end(), [&m_vec](int x) { cout << m_vec
^
compilation aborted for test.cpp (code 2)
The [&m_vec] should be [this]. It seems like there is compatibility issues between ICC/GNU GCC on this. The standard seems to say [this] is correct. Perhaps this issue could be resolved to make ICC compatible with GCC?
Thanks.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
...
for_each( idx.begin(), idx.end(), [&m_vec](int x) { cout << m_vec << "\n"; } );
...
Are you sure thatthe Last term of 'for_each'statement can't be evaluated bythe C++ compilerto a function with one argument?
for_each( idx.begin(), idx.end(), [&m_vec](int x) { cout << m_vec
...
Are you sure thatthe Last term of 'for_each'statement can't be evaluated bythe C++ compilerto a function with one argument?

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page