What is the operations or treatments we can do on xvalues and not on prvalues and vice versa

StackOverflow https://stackoverflow.com/questions/20786005

  •  21-09-2022
  •  | 
  •  

Question

I'm wondering why rvalue expressions are subdivided in two groups (xvalues and prvalues).

Saying differently is there a lot of place where the treatment on rvalues is different according to the fact the expression is either an xvalue or a prvalue? (I think for instance at copy-elision are feature like that). Too much to be enumerated here maybe?

Was it helpful?

Solution

I am somewhat unclear on what is asked, but some of the differences between xvalues and prvalues are:

  • non-class xvalue can be cv-qualified, prvalue can't be

  • class xvalue can be polymorphic, class prvalue is always its most derived type

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top