Lvalue Rvalue and Their References With Example in C++

This topic might be a piece of cake for every experienced C++ veteran. But I remember back in the days when I was a novice & introducing myself with Modern C++, I was really irritated by C++ compiler messages saying this is lvalue & that is rvalue kind of jargons. And even if you are not using C++, you may have faced compiler error in C language saying “lvalue required as left operand of assignment”....

September 15, 2019 · 9 min · 1820 words · Vishal Chovatiya

Move Constructor & Assignment Operator With std::shared_ptr

In an earlier article, we have seen how move constructor & move assignment operators helped us in creating our own unique_ptr. Here we will use move constructor & assignment operator to implement unsophisticated shared_ptr. Implementing Our shared_ptr with Move Constructor & Assignment Operator In some cases, we have a requirement where a single resource is represented by multiple pointers. We can not accomplish this by std::unique_ptr. To accomplish this, we can add a new variable to our smart pointer class which keeps track of reference count at the real-time....

September 15, 2019 · 5 min · 913 words · Vishal Chovatiya