Forward Declaration for a Class from a Namespace

Suppose you have a class declare in a namespace, like this: #pragma once namespace Test { class foo { public: foo(void); ~foo(void); }; }; #include “foo.h” namespace Test { foo::foo(void) { } foo::~foo(void) { } }; And you want to use that foo class in a another class, with a forward declaration: #pragma once class … Read more

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 … Read more

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. class stringutils { public: static void make_upper(std::string& text) { … Read more