July 31, 2001

Using a Template Member Function

An ordinary class may have template member functions. In the following example, the class A declares a template member function called f(): class A{public: template T f(T t);}; You may define the template member function inside the class body, as in: class A{public: template T f(T t) { return t;}};

Template Parameters and Template Arguments

The terms template argument and template parameter do not mean the same thing. A template parameter is a symbol, or a placeholder which is replaced by the actual argument when you instantiate a template. For example, T in the following template is a template parameter: template < class T >

To DLL or not to DLL?

Many Windows programmers use DLLs abundantly. Although dynamic linking certainly offers some advantages, it can also cause noticeable maintenance and performance setbacks. For starters, DLLs are slower than statically linked libraries. Their slowness results from the inherent complexities of locating the address of a function or a data structure at

Memory Deallocation Myths

A common myth among programmers says that you can avoid calling delete in your application because the operating system will release the allocated memory when the application terminates anyways. Indeed, modern operating systems release leaked memory after an application terminates. However, there’s a substantial difference between releasing raw memory and