Using boost::bind as an improved means of calling member functions

This post takes a look at using boost::bind as a means of calling class
member functions in an efficient and generic way. It basically summarizes what has
already been said at Björn Karlsson’s excellent Informit article. Since I found the post useful, I thought it worth reproducing here, using the same status class but containing all the examples and approaches he describes in one program. Continue reading

Creating smart pointers in C++

Introduction

What are smart pointers? They are a means of handling the problems associated with normal pointers, namely memory management issues like memory leaks, double-deletions, dangling pointers etc. This post gives a simple guide to creating your own smart pointer in C++. As a simple starting example, consider a basic template class which can be used to hold generic data types:
Continue reading

Mixing Managed and Native Types in C++ / CLI

Brief Introduction

C++/CLI (Common Language Infrastructure) was designed to bring C++ to .NET as a means of developing managed code applications. Specifically it helps simplify writing managed code when using C++.

Suppose you are writing a WinForms application in Microsoft Visual Studio with a view to using C++ to write managed code. You may prefer to reuse existing libraries and headers written in C and C++ but are a little unsure as to how this is achieved exactly.
Continue reading

Using Smart Pointers to Avoid Memory Leaks

Using boost::scoped_array

When we want to dynamically allocate an array of objects for some purpose, the C++ programming language offers us the new and delete operators that are intended to replace the traditional malloc() and free() subroutines that are part of the standard library :
Continue reading