Virtual destructor

A virtual destructor is used when you have a base class with a virtual function and you want to ensure that the destructor of the derived class is called properly when deleting an object through a pointer to the base Read More …

Comparator

A comparator is a function or an object used to define the ordering or comparison between two elements. It is often used in sorting algorithms or data structures like sets and maps. Here’s an example of how to use a Read More …

Function Pointer

A function pointer is a variable that can store the address of a function. It allows you to call a function indirectly by using the pointer. This feature is particularly useful when you want to pass a function as an Read More …

Rule of zero

The “Rule of Zero” is a principle in C++ that suggests avoiding explicit resource management in your classes whenever possible. The rule states that if a class doesn’t need to manage any resources (such as dynamically allocated memory) or doesn’t Read More …

Rule of five

The “Rule of Five” in C++ refers to a guideline for implementing the five special member functions in a class when managing resources. These special member functions are: The Rule of Five suggests that if you need to explicitly define Read More …

Rule of three

The “Rule of Three” is a guideline in C++ that suggests implementing three special member functions when you have a user-defined class that manages dynamically allocated resources. These special member functions are the destructor, copy constructor, and copy assignment operator. Read More …

Smart Pointer

A smart pointer is a class template that provides automatic memory management for dynamically allocated objects. It helps prevent memory leaks by automatically deallocating the memory when it’s no longer needed. The two commonly used smart pointers in C++ are Read More …

Lambda

A lambda function is an anonymous function that you can define inline within your code. It allows you to create a function object on the fly without explicitly defining a named function. Lambda functions are useful when you need a Read More …

Reinterpret Cast

reinterpret_cast is a type of casting operator that allows you to convert a pointer of one type to a pointer of another type, or to convert an integral type to a pointer type and vice versa. It is considered a Read More …