Apparently genuine code gives compilation errors

Discussion in 'C++' started by Luca Risolia, Oct 20, 2012.

  1. Luca Risolia

    Luca Risolia Guest

    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.
    Luca Risolia, Oct 20, 2012
    #1
    1. Advertising

  2. Luca Risolia

    Marc Guest

    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/wg21/docs/lwg-active.html#2106
    Marc, Oct 20, 2012
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jonas
    Replies:
    2
    Views:
    2,813
    KevinAndrewLipscomb
    Dec 2, 2010
  2. smart_mundial
    Replies:
    0
    Views:
    325
    smart_mundial
    Nov 26, 2004
  3. Xiaozhong
    Replies:
    4
    Views:
    418
    Matthias Buelow
    Jan 23, 2008
  4. * Its my Pleasure *
    Replies:
    0
    Views:
    374
    * Its my Pleasure *
    Feb 20, 2008
  5. Jonathan N. Little

    Re: Free Genuine Windows 8

    Jonathan N. Little, Mar 9, 2012, in forum: HTML
    Replies:
    0
    Views:
    419
    Jonathan N. Little
    Mar 9, 2012
Loading...

Share This Page