Variadic template make_CString for MFC's CString

  • Posted on: 27 February 2016

For reasons beyond my control, I often work with a codebase that makes use of Microsoft MFC's string class, CString. CString has its detractors and proponents. I don't have a whole lot to add to the debate that hasn't been said already. Instead, I'm going to focus on using C++ variadic templates to get around one of my least favorite CString "anti-idioms". Since I'm not overly familiar with variadic templates, I plan to go over them in slow-mo.

My First Experiment with C++'s std::thread

  • Posted on: 30 January 2016

std::thread is a big step forward for multi-threaded applications written in C++. I suppose people have written their own cross-platform thread wrappers before, but for the rest of us, there's no more dealing with POSIX threads vs. Windows threads etc. std::thread is also far more 'natural' to C++ than openMP is out of the box, which is what I used pretty often in the past. By natural, I mean that one can write:

C++ Lambda Functions with std::sort -- A Brief Tutorial

  • Posted on: 17 August 2014

C++11 added Lambda Functions to C++, a feature many developers felt was long overdue.

There are a lot of tutorials on the web already about using Lambdas in C++. These tutorials cover all the wide variety of ways which Lambdas can be used in C++, as well as possible reasons for doing so.

I thought I'd throw my hat in the mix, and try to provide an ultra-short, ultra-simple example, adapted from code you may have seen before. We're just going to use a Lambda function to extend the functionality of std::sort.

First, I'm going to use this code for a starting point for this tutorial. So make sure that that's fully digested before heading over here.