Singleton class ensures that there will be only one object of the class in lifetime of a program. Normally we can create as many objects as we want from a…
std::shared_ptr is a smart pointer that manages shared ownership of an object through pointer. Multiple std::shared_ptr (s) can hold the same object pointer. The actual object gets deleted when all…
Here we'll write a C function to merge two sorted arrays into one. The merged array will also be sorted. Here we'll use two sorted integer arrays that are sorted…
The std::unique_ptr has unique ownership of the object it manages. That means that more than one std::unique_ptr object can not contain the managed object pointer. That’s why we can not…
In my previous article, we discussed how std::unique_ptr helps to avoid memory leak. By default it calls the default deleter (C++ delete operator) when the std::unique_ptr goes out of context.…