How is C++ STL list implemented internally

The previous article in this series called STLHow, showed how to implement STL Vector. This article will go into details about implementation of STL list. Implementing STL List The node The STL list requires traversal in both the directions by means of forward and reverse iterator. Hence the list should be implemented as a doubly linked list. The node of the list is defined as below.

 List class

The list maintains pointers to […]

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 […]

Vim : Block select on windows and Linux

Vim allows selection of a block or column of text. Then operations like cut or delete can be performed on the selected block of text. Enter following command to start block selection mode. Windows


Then select the block with arrow keys or h/j/k/l keys.   image credit Brian Dill

Sybase : Iterating over table without using cursor

Cursor is not the only way to iterate over data in a table in sybase. It is possible to iterate over a table without using cursor. This article shows an alternative to cursor in sybase. If a table has a clustered index defined on a column (or set of columns) then the rows in that table are organized in a sorted order by the indexed columns. This property of the clustered index can be used […]

Floating help box with jQuery UI tooltip

jQuery UI has a nice tooltip widget. This widget is used to display a theamable tooltip for elements on a web page. That is the primary and intended use of the tooltip widget. However this widget can be innovatively used to display a startup help box. Startup helpbox is used to display a quick instruction to the user. It is intended to get user started with the website or application. This help box disappears as […]