Skip to content
serhij.zolotukhin edited this page May 8, 2026 · 6 revisions

Value Categories in C++17

The most important thing to remember is that value categories are a taxonomy of expressions. They are not categories of objects or variables or types.

expression glvalue - has identity (Addressable) lvalue - Can be moved from = NO xvalue - Can be moved from = YES - (expiring value)
rvalue - no identity (Not addressable) xvalue - Can be moved from = YES prvalue - Can be moved from = YES - (pure rvalue)

properties those expressions

  • has identity (Addressable, persistent object in memory) - no identity (Not addressable)
  • Can be moved from

https://medium.com/@barryrevzin/value-categories-in-c-17-f56ae54bccbe https://medium.com/@sagar.necindia/c-11-understand-value-categories-c9306976bfda https://habr.com/ru/articles/479342/ https://en.cppreference.com/cpp/language/value_category

lvalue reference -> lvalue const lvalue reference -> rvalue rvalue reference -> rvalue only !!! unversal reference - ?

std::move - cast lvalue to rvalue std::forward

Simple Forwarding Perfect Forwarding

https://habr.com/ru/articles/869854/

Compiler-generated Functions, Rule of Three and Rule of Five

https://www.fluentcpp.com/2019/04/19/compiler-generated-functions-rule-of-three-and-rule-of-five/

https://medium.com/embedworld/move-semantics-in-modern-c-faster-object-transfers-without-copying-d5f1205da44c


move operations include:

  • move constructor
  • move assignment operator

DArray(DArray &&other) noexcept DArray& operator=(DArray&& other) noexcept

Move operations may be explicitly specified or implicitly generated.


https://medium.com/@candyreddh/modern-c-insights-the-generation-of-special-member-functions-7733d578cc0a Since the C++ 11, there are 6 special member functions which may be generated by the compiler. They are:

  • default constructor
  • copy constructor
  • copy assignment
  • move constructor
  • move assignment
  • destructor

https://en.cppreference.com/cpp/language/copy_assignment

URLs

https://www.youtube.com/watch?v=Oma4Ag-snE4&list=PLaSMZtEVIQLfkQ5rV839mtFUXXNTgiGAx&index=8 https://www.youtube.com/watch?v=QSIBUblx0J0&list=PL9aFcBWVu5htdYy3scDw9oNdw9Lrff59S&index=1 https://www.youtube.com/watch?v=x5am_9qCMLQ

My side bar

Clone this wiki locally