Forward Declaration for a Class from a Namespace

Suppose you have a class declare in a namespace, like this:

And you want to use that foo class in a another class, with a forward declaration:

Most likely you’ll get some errors, like this (issues by VS2008 compiler) error C2872: ‘foo’ : ambiguous symbol error C2512: ‘foo’ : no appropriate…

C# ListBox with Variable Height Items

Suppose you need a ListBox that has to display items with the text spread across multiple lines. With the default implementation that would look like this: The CR LF characters are displayed as squares and the item has only one line of text. To make the list box items have variable height depending on the…

STL string utils

STL’s std::string doesn’t have methods for transforming the string to upper or lower case or for trimming (as other string implementations, such as CString, have). I’ve noticed that many people don’t know how to implement such functions, so I’ll show you here how to do that.

You can use it like this: