Apparently genuine code gives compilation errors

L

Luca Risolia

Hello,

does the following block of code compiles for you?

{
// The following does compile with std::vector, std::map, etc..
typedef std::set<std::string> Container;
Container c;
std::for_each(std::make_move_iterator(c.begin()),
std::make_move_iterator(c.end()),
[](const Container::value_type &) {}); // or &&
}

I get compiler errors from both clang and g++ 4.7 in the only case
Container is std::set.

I will omit the error from the compiler, since I suspect it's a bug in
the implementation I am using, but I would like to have your opinions
based on the source code purely, since I do not see anything wrong.
 
M

Marc

Luca said:
Hello,

does the following block of code compiles for you?

{
// The following does compile with std::vector, std::map, etc..
typedef std::set<std::string> Container;
Container c;
std::for_each(std::make_move_iterator(c.begin()),
std::make_move_iterator(c.end()),
[](const Container::value_type &) {}); // or &&
}

I get compiler errors from both clang and g++ 4.7 in the only case
Container is std::set.

I will omit the error from the compiler, since I suspect it's a bug in
the implementation I am using, but I would like to have your opinions
based on the source code purely, since I do not see anything wrong.

This seems related to:
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#2106
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top