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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:01:02+00:00 2026-05-31T09:01:02+00:00

I am currently writing my degree dissertation and it involves also some explaining of

  • 0

I am currently writing my degree dissertation and it involves also some explaining of the theory behind C++11 which is really fine as C++ is my programming language of choice and the standard is more or less available for free (N3337) to get yourself lost in.

Yet I have hit a wall while trying to explain the new xvalue category accurately and in detail. It is my understanding that a temporary object is always a xvalue but I cannot find any reference to this in the standard. It is my understanding that the value category of an expression of a function call to a function that has a non-reference return type, is a xvalue. The standard says that “a xvalue is the result of certain kind of expressions that involve rvalue-references” which is bugging me. For example:

TestClass { ... };
testClass createObject() { return testClass(); }

void someFunction(TestClass& testClass) { ... }
void someFunction(TestClass&& testClass) { ... }

someFunction(createObject());

The above will, as expected, call the overloaded function which takes an rvalue-reference as parameter. Yet createObject() does not return a rvalue-reference, it returns a temporary object of type TestClass. My problem is now, I have to explain the reasons behind it. What does the expression “createObject()” evaluate to? If it is indeed a xvalue because it returns a temporary object, the reasoning behind it is clear and the rvalue-reference is favored during overload resolution. If it does not, what is the explanation for this behaviour with regard to the standard? Is there some implicit conversion logic defined somewhere that I haven’t found yet?

I’d really appreciate if someone could help me out on this one because even after days of digging and reading, I have yet to come up with a sound explanation. Thanks a lot 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-05-31T09:01:03+00:00Added an answer on May 31, 2026 at 9:01 am

    Objects are never {l|r|x}values. value categories describe expressions.

    xvalue is the value category of the function call expression where the function return type is an rvalue reference to object (e.g. std::move), and it is also the value category of the cast expression where the cast is to an rvalue reference to object (e.g. the guts of std::move).

    The function call expression createObject() in your example is an prvalue expression because it is a function call to a function with non-reference return type.

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

Sidebar

Related Questions

I'm currently working on my Dissertation for my degree, and in writing my report,
I'm currently writing a TYPO3 extension which is configured with a list of tt_content
I'm currently writing some general purpose .net libraries that contain usual helper classes. For
I'm currently writing a application that needs to capture some images. I start the
Currently writing a roguelike to learn more about Objective-C/Cocoa. I'm really enjoying it so
I am currently writing some extensions in twig, but I am having trouble deciding
I'm currently writing some MATLAB code to interact with my company's internal reports database.
I'm currently writing some methods that do some basic operations on form controls eg
I'm currently writing an custom control which has to hold child control and have
I am currently writing an application ( App1 ) which retrieves portions of text

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.