Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Apparently genuine code gives compilation errors

Reply
Thread Tools

Apparently genuine code gives compilation errors

 
 
Luca Risolia
Guest
Posts: n/a
 
      10-20-2012
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.
 
Reply With Quote
 
 
 
 
Marc
Guest
Posts: n/a
 
      10-20-2012
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compilation debug=false in web.config gives errors in application Jonas ASP .Net 2 12-02-2010 05:41 PM
The following code gives two "Identifier expected" errors AAaron123 ASP .Net 0 03-12-2009 02:17 PM
Compilation errors in templated code Saulius C++ 7 01-19-2004 12:17 AM
Errors, errors, errors Mark Goldin ASP .Net 2 01-17-2004 08:05 PM
split() in String gives compilation error Nishi Bhonsle Java 4 12-23-2003 07:34 PM



Advertisments