C++: Using the Move Constructor & Move Assignment Operator

C++ 20    |    Expert
  • 11 Videos | 1h 23m 7s
  • Includes Assessment
  • Earns a Badge
References are an important part of C++, and a little-known fact about references is that there are actually two types of references: l-value and r-value. In this course, explore those two reference types by learning how to use the syntax and semantics of r-value references to extend the lifespan of transient values. Then, implement the move assignment operator and move constructor, using r-value references as their input arguments, to reduce the number of unnecessary copies created in your C++ programs. Finally, work with Resource Acquisition Is Initialization (RAII) to use smart pointers as a way to bypass complex rules, such as the rule of three and the rule of five, allowing you to follow the simplest rule of all - the rule of 0.

WHAT YOU WILL LEARN

  • discover the key concepts covered in this course
    contrast l-values and r-values
    create l-value and r-value references using the & and && operators
    implement move constructors and move assignment operators
    illustrate how extraneous copies of objects can be created when not using r-value references
    recognize the efficiency improvements triggered by move constructors
  • define a move assignment operator
    outline the features of the move assignment operator
    outline how resource acquisition is initialization (RAII) results in simpler and less error-prone code
    list the benefits of RAII
    summarize the key concepts covered in this course

IN THIS COURSE

  • Playable
    1. 
    Course Overview
    2m 6s
    UP NEXT
  • Playable
    2. 
    Contrasting L-Values and R-Values
    6m 54s
  • Locked
    3. 
    Using L-Value and R-Value References
    5m 24s
  • Locked
    4. 
    Implementing the Rule of 5
    10m 37s
  • Locked
    5. 
    Illustrating the Need for R-value References
    7m 10s
  • Locked
    6. 
    Illustrating the Advantages of Move Constructors
    7m 33s
  • Locked
    7. 
    Using Move Assignment Operators
    8m 29s
  • Locked
    8. 
    Outlining Features of the Move Assignment Operator
    10m 58s
  • Locked
    9. 
    The RAII Paradigm
    9m 36s
  • Locked
    10. 
    Using RAII and the Rule of 0
    11m 32s
  • Locked
    11. 
    Course Summary
    2m 48s

EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE

Skillsoft is providing you the opportunity to earn a digital badge upon successful completion of this course, which can be shared on any social network or business platform

Digital badges are yours to keep, forever.