Search:

Type: Posts; User: anon

Search: Search took 0.05 seconds.

  1. Replies
    22
    Views
    4,806

    If I'm not mistaken, you get default move...

    If I'm not mistaken, you get default move constructors under certain conditions: no user-defined copy constructor + no user-defined destructor + all members are movable, or something like that. (This...
  2. Replies
    22
    Views
    4,806

    A&& foo() { static A test(std::rand());...

    A&& foo()
    {
    static A test(std::rand());
    return std::move(test);
    }


    This function is also horribly broken.

    1) If your test program shows two different values from foo, that's because...
  3. Replies
    22
    Views
    4,806

    You must not return references to locals, rvalue...

    You must not return references to locals, rvalue or not.

    You return local variables by value, and in C++11 this will invoke move constructor/assignment - if the copy is not elided altogether.
Results 1 to 3 of 3