C++ auto_ptr for pointer to array

An auto_ptr can wrap a raw pointer but this raw pointer should not be a pointer to an array because auto_ptr will not release memory of the array when it goes out of scope. auto_ptr calls delete on the pointer when it goes out of scope. However for memory pointed to by an array pointer is to be freed then delete[] needs to be called and not delete. How can you have an auto_ptr for […]

How is C++ STL vector implemented internally

There are many open source implementations of STL. However it is difficult to read the STL code because it is meant to be practically usable than readable. STLHow is an implementation of C++ Standard Template Library (STL) written in easy to understand and human readable code. A series of articles here on codefreakr will discuss the STLHow to demonstrate “How the STL is implemented”. Implementing STL Vector Constructors and Destructor Vector is implemented as a […]