Category Archives: C++0X/C++11

Working with C++0X/C++11: Lambdas – part 4 – using closures

In my last C++11 blog I talked about creating functions that takes a storage location by reference and return a function that takes a string input, parses it and stores the resulting value into the storage location. So we’re creating … Continue reading

Posted in C++0X/C++11, Code | Leave a comment

Working with C++0X/C++11: Lambdas – part 3 – introducing closures

Closure In computer science, a closure (also lexical closure, function closure, function value or functional value) is a function together with a referencing environment for the non-local variables of that function. A closure allows a function to access variables outside … Continue reading

Posted in C++0X/C++11, Uncategorized | Leave a comment

Working with C++0X/C++11: Lambdas – part 2 – Scope Capture

Since a lambda is a local function defined with a scope (i.e. inside another function) it can have access to the same variables that are in that scope. This is where the capture-mode comes in. (Perversely, this prevents lambdas from … Continue reading

Posted in C++0X/C++11, Code, Uncategorized | Leave a comment

Working with C++0x/C++11: Lambdas – part 1- Syntax

Lambdas are new to C++0x and if you are familiar with functors then you already have a good idea of how lambdas can be used. Where lambdas really become useful (in my opinion) are allowing you to encapsulate behavior (as … Continue reading

Posted in C++0X/C++11, Code | Leave a comment

Working with C++0x/C++11: nullptr and nullptr_t

One my pet peeves with C/C++ are null pointers – specifically not having a good way of specifying a special pointer value that means “invalid pointer”. C (and C++) have a preprocessor macro NULL, which in C expands to either … Continue reading

Posted in C++0X/C++11, Code | Leave a comment

Working with C++0x/C++11: static_assert and decltype

I have been writing a lot of code the last few months, and I’ve had a chance to play with some of the new C++0x features. It’s really the first time in many years that there’s been a significant improvement … Continue reading

Posted in C++0X/C++11, Code | Leave a comment