0

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?

David G
  • 94,763
  • 41
  • 167
  • 253
Guillaume Paris
  • 10,303
  • 14
  • 70
  • 145

1 Answers1

3

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

Cubbi
  • 46,567
  • 13
  • 103
  • 169
  • Cubbi: Are you agree on the fact than c++ compiler can only realize copy elision with prvalue object type ? – Guillaume Paris Dec 27 '13 at 13:51
  • 1
    @Guillaume07 copy/move elision is not specified in terms of expressions. It deals with objects (automatic non-volatile, non-referenced temporary, and the exception object). – Cubbi Dec 27 '13 at 14:03