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

Could someone please explain the best way to connect to an Interbase 7.1 database
Could someone please explain? I couldn't find anything on the internet, everything talks about
Could someone simply explain the 3 phases in the Flash Event framework, please? By
I've recently written this with help from SO. Now could someone please tell me
Please could someone explain me what's the difference between public and published class members
Could someone please explain to me why recursive-descent parsers can't work with a grammar
Could someone please explain when would I want to use delegation instead of inheritance?
could someone please explain why the following code is throwing an error? // JavaScript
Could someone please explain owner/group/public permissions on files and directories in a web environment.
Could someone please explain to me how to draw a string using UIStringDrawing instead

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.