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

  • SEARCH
  • Home
  • 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 7913213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:47:22+00:00 2026-06-03T13:47:22+00:00

So Move semantics is great, giving us higher performence. I read this was a

  • 0

So Move semantics is great, giving us higher performence.

I read this was a completly new feature and without C++11 it is ‘impossible’ to do this.

But could we do this before C++11? Like something that goes like the below.

class AAA
{
private:
    int* m_data;
public:
    AAA(int _data) : m_data(new int(_data)) { }
    AAA(AAA& _other) // Not using RValue reference.
    {
        m_data = _other.m_data;
        _other.m_data = nullptr;
    }

    ~AAA() { delete m_data; }
};

int main()
{
    AAA sth1(100);
    AAA sth2(sth1)
    return 0;
}

I thought that what the existence of RValue reference is for is not to make the same functions whose argument is just slighty different(like Const and Non-Const).

Simply, with RValue reference which is just another ‘type’, we can do both Copy constructor and Move constructor at the same time. And that’s it.

Wondering if I am correct or am missing something huge.

Thanks in advance.

  • 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-06-03T13:47:24+00:00Added an answer on June 3, 2026 at 1:47 pm

    std::auto_ptr did exactly what you suggest. The problem was that it made behavior confusing and copying impossible. Rvalue references allow one to make classes that can be both moved and copied.

    rvalue references allow automatic moving/copying based upon context (for example the moving of a temporary) trying to simulate this with an lvalue style copy constructor (which actually performed a move) would likely be disastrous.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to move semantics in C++11 and I don't know very well how
My head hurts: I've read so many blogs about C++11x's move semantics that my
Suppose you want to take advantage of move semantics, but one of your movable
I think I do understand the basic IDEA of move semantics, but now when
Is this the right way to use C++11 rvalue-references and move semantics to implement
After doing some experimentation with move semantics with an array type I created, I
I am currently trying to figure out how to do move semantics correctly with
I am wondering what is the origin of move semantics in C++? In particular
I have been testing with rvalue references and move semantics and want to make
I'm trying to understand rvalue references and move semantics of C++11. What is the

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.