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 6943303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:08:16+00:00 2026-05-27T13:08:16+00:00

I might be confusing here but what I did understand is that : COW

  • 0

I might be confusing here but what I did understand is that :

  • COW will return a "fake" copy until one of the callers want to make some modifications.
  • Move Semantic will return a "fake" copy in all cases.

So if my purpose is to have an object that only need to be read and not updated, I should only wait for move semantics support in my C++ compilers ?

Am I right ?

  • 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-27T13:08:17+00:00Added an answer on May 27, 2026 at 1:08 pm

    Move semantics does not return a “fake” copy. Instead, in a copy operation, it gives the copyee permission to trash the original copy.

    A motivating example may be instructive:

    std::vector<int> bigData;
    
    // fill bigData
    
    std::vector<std::vector<int> > listOfData;
    
    listOfData.push_back(std::move(bigData));
    // after this point, the contents of bigData are unspecified (however accessing it is _not_ undefined behavior)
    

    Without move semantics, you’d need to copy bigData to insert it into listOfData, or manually twiddle with swap() into a new empty vector that’s in listOfData. But with move semantics, the rvalue-reference-constructor (aka move constructor) of std::vector, invoked by push_back as it copies in the new data, has permission to trash the old contents of bigData – thus, it’s allowed to steal bigData‘s internal pointer and reset bigData to an empty vector, for example.

    Move semantics are usually faster than COW semantics as they don’t need to maintain reference counts to shared, read-only data. They are, however, more limited – you can’t create multiple reference-counted aliases to your data with move semantics, you can just easily and conveniently shuffle data between containers.

    Also note that both recent versions of GCC and Microsoft Visual C++ support rvalue references and move semantics (GCC with --std=c++0x), so there’s no reason not to start using them today.

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

Sidebar

Related Questions

my question might be a bit confusing, but here is what i would like
Okay so the title might sound a bit confusing, but here's what I want
Ok this might be a bit confusing, but here goes. Let's say I have
This one might be a little confusing. I'm using AMCharts with rails. Amcharts comes
Might be subjective and/or discussion.. but here goes. I've been asked to estimate a
This might be confusing but what I want to do is a basic select
My question might be kinda confusing but I'll try my best to explain it.
Alright, I might make this confusing, but hopefully not. So I have a UITableView
the question might be a bit confusing, so here is what i have: i
It might be confusing and a bit difficult. I have a $fcomm variable that

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.