In the last article, I explained the different value categories. In this article, I'll elaborate on the C++ move semantics. Let's review this code: #include <iostream> #include <string> class DataStructure { public: DataStructure (uint64_t size) : m_size(size), m_data(new uint64_t[m_size]) { print("ctor"); } ~DataStructure () { print("dtor"); if (m_data) { delete[] m_data; m_data = nullptr; }… Continue reading I Like To Move It Move It
Month: September 2020
Value Categories In C++
In C++, every expression has a value category. In C++03 (and before), we had two value categories: lvaluervalue In C++11 (and later), we were introduced with new categories: lvaluervalue - prvalue or xvaluexvalueglvalue - lvalue or xvalueprvalue - C++03 rvalue In this article, I'll explain the categories and in the next article, I'll elaborate on… Continue reading Value Categories In C++