Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3669176
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:12:43+00:00 2026-05-19T02:12:43+00:00

Please, could someone explain in plain English what is Extending move semantics to *this?

  • 0

Please, could someone explain in plain English what is “Extending move semantics to *this”? I am referring to this proposal. All what am looking for is what is that & why do we need that. Note that I do understand what an rvalue reference is in general, upon which move semantics is built. I am not able to grasp what such an extension adds to rvalue references!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T02:12:43+00:00Added an answer on May 19, 2026 at 2:12 am

    The ref-qualifier feature (indicating the type of *this) would allow you to distinguish whether a member function can be called on rvalues or lvalues (or both), and to overload functions based on that. The first version gives some rationale in the informal part:

    Prevent surprises:

    struct S {
      S* operator &() &;            // Selected for lvalues only
      S& operator=(S const&) &;     // Selected for lvalues only
    };
    
    int main() {
      S* p = &S();                  // Error!
      S() = S();                    // Error!
    }
    

    Enable move semantics:

    class X {
       std::vector<char> data_;
    public:
       // ...
       std::vector<char> const & data() const & { return data_; }
       std::vector<char> && data() && { return data_; } //should probably be std::move(data_)
    };
    
    X f();
    
    // ...
    X x;
    std::vector<char> a = x.data(); // copy
    std::vector<char> b = f().data(); // move
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please could someone explain to me why this regex does not match anything, when
Could someone please explain why this is happening? var y = new int[]{1,2}; Console.WriteLine(y
Could someone please explain this weird phenomenon: http://jsfiddle.net/sPA2V/ For some reason, the box footer
Could someone please help explain why I can't get this to work? I properly
Could someone please explain why when you have an plain widget as one line
could someone please explain this to me: I have an MVC method I want
Could someone please explain, what exactly this O_LARGEFILE option does to support opening of
Could someone please explain to me the difference between the combo box that's available
Could someone please explain what the for loop in this class does? Specifically the
Could someone please explain to me why this simple straight forward code isnt working,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.