C++

C++ Templates

Most of the information is taken from C++ Templates: The Complete Guide, by David Vandervoorde and Nicolai M. Josuttis. C++ templates allow you to write functions or classes that prescribe behavior for an arbitrary data type. Instead of duplicating code for each type that it should handle, you write the logic once and indicate that […]

C++ Shared Pointer

Let’s write a C++ shared pointer. Shared pointers are smart pointers that ensure the freeing of memory when the last reference to it is deleted. Fundamentally, smart pointers take advantage of a class’ destructor. When an object goes out of scope, its destructor is called. When a shared pointer goes out of scope, logic in […]

Scroll to top