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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:12:30+00:00 2026-06-07T01:12:30+00:00

Here’s the compiler splash screen (for version etc.): C:\Program Files\Microsoft Visual Studio 10.0\VC>cl.exe Microsoft

  • 0

Here’s the compiler splash screen (for version etc.):

C:\Program Files\Microsoft Visual Studio 10.0\VC>cl.exe
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]

I have a base class (which is a template), imagine it’s:

template <typename T>
class Base {

    public:

        Base<T> & operator = (const Base<T> &);
        Base<T> & operator = (Base<T> &&);

};

I then have a derived class which doesn’t reimplement operator = in any way.

If I do the following:

Derived<int> derived;
derived=Derived<int>();

the operator = which accepts an lvalue is called on the second line.

If I go into the definition of Derived<T> and add the following:

template <typename T>
Derived<T> & Derived<T>::operator = (Derived<T> && other) {

    Base<T>::operator=(static_cast<Base<T> &&>(other));

    return *this;

}

The operator = which accepts an rvalue is called.

This behaviour persists even if I also implement the operator = which takes an lvalue (in much the same manner).

For lack of a better phrase: What gives?

Am I misunderstanding C++ or is this not how it’s supposed to work?

  • 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-07T01:12:31+00:00Added an answer on June 7, 2026 at 1:12 am

    MSVC never generates implicit move construction/assignment. See http://msdn.microsoft.com/en-us/library/dd293668.aspx .

    The reason is that implicit move semantics have undergone many changes during standard elaboration, and the final consensus was not here at the time MSVC10 was finished.

    Bottom line: you have to declare explicitly every move constructor / move assignment operator you’d like to use by hand. There is no = default modifier to help you. This means writing a lot of swap member functions, or simply give up on move semantics unless you 1) really need them (non copyable classes) or 2) have profiled your code and need to get rid of copies.

    Default copy assignment is generated implicitly, and this is what you get here.

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

Sidebar

Related Questions

here are 2 screen shots when i try to debug my code in visual
Here's my test function (c#, visual studio 2010): [TestMethod()] public void TestGetRelevantWeeks() { List<sbyte>
Here is my persistence.xml : <?xml version=1.0 encoding=UTF-8?> <persistence xmlns=http://java.sun.com/xml/ns/persistence xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd version=1.0>
Here's what I'm trying to accomplish with this program: a recursive method that checks
Here's my Manifest: <?xml version=1.0 encoding=utf-8?> <manifest xmlns:android=http://schemas.android.com/apk/res/android package=com.mappp.mobile android:versionCode=1 android:versionName=1.0 > <supports-screens android:largeScreens=true
Here is my program to find all the subsets of given set. To solve
Here is my code, which takes two version identifiers in the form 1, 5,
Here is a broken down version of my problem : I have a method.
Here's the view: @if (stream.StreamSourceId == 1) { <img class=source src=@Url.Content(~/Public/assets/images/own3dlogo.png) alt= /> }
Here's my code in the <head></head> : <link rel=stylesheet href=http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css /> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.1.min.js></script>

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.