Learn State Design Pattern by Designing a Simple Music System
Many times we need to develop systems / objects that provides services to outside world. But the response of each service is not always same, it depends upon its current internal state.
Many times we need to develop systems / objects that provides services to outside world. But the response of each service is not always same, it depends upon its current internal state.
While creating and using std::vector with user defined classes we needs some special care otherwise it can hamper the performance of our application.
std::find and std::find_if algorithms are used to find first element in the given range.
Lets remove all duplicate elements from a sorted singly linked list.
Suppose we have a linked list and we want to reverse it in Single iteration and O(n) complexity.
Suppose we have an int array and we want to create it into a singly linked list from it.
Main advantage of shared_ptr is that it automatically releases the associated memory when not used any more.
We should create shared_ptr objects carefully. Checkout below two cases,
In this article we will compare C++11 Smart Pointer Implementation shared_ptr and a normal pointer.
In this article we will discuss how to use custom deleter with std::shared_ptr.