Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   Apparently genuine code gives compilation errors (http://www.velocityreviews.com/forums/t953665-apparently-genuine-code-gives-compilation-errors.html)

Luca Risolia 10-20-2012 07:18 PM

Apparently genuine code gives compilation errors
 
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.

Marc 10-20-2012 08:06 PM

Re: Apparently genuine code gives compilation errors
 
Luca Risolia wrote:

> 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/wg...tive.html#2106


All times are GMT. The time now is 04:55 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.