Tag Archives: cplusplus11

Pointer Implications (C++11)

While C++98 had smart pointers of a sort; they weren’t good enough for use. The language lacked the key feature that makes smart pointers work: move semantics. C++11 has introduced that language feature, and hence has solid smart pointers. The addition of smart pointers gives us some further options for passing references to objects when… Read More »

Delegation

Last time, I spoke about lambdas, and left you with this comment about other features of lambdas. One that’s particularly worth bearing in mind is the ability to pass this as a lambda parameter. That means you can get access to more than just the enclosing scope variables, you can get access to the enclosing… Read More »

La Lambda

Let’s say we’ve loaded a database table into memory and now we want to do some work with it. I’m imagining a case where we’ve selected a small subset of records from an enormous table (i.e. it wasn’t cheap to fetch) and we want to pull records that meet particular conditions from our subset. Let’s say… Read More »

Cloners

Let’s say we are reading tagged blocks from within some sort of packet. The blocks being tagged means we won’t care whether they’re present, what order they come in, and can have each tag be a different length. <tag2> <tag2_data0> <tag2_data1> … <tag2_data11> <tag1> <tag1_data0> <tag1_data1> … <tag1_data8> <tag6> <tag6_data0> <tag6_data1> … <tag6_data20> <tag3> <tag3_data0>… Read More »

Not Everything Is A Reference

I like Java as a language. Kind of. It’s strongly and statically typed, has object oriented syntax, reflection, exceptions, and interfaces (interfaces being one of the few features that I think C++ is missing). Dynamically typed languages encourage sloppiness, and don’t help you avoid sloppiness, and the overriding feature of all good software is that… Read More »

Copy and Swap Idiom

I learned a new trick today, while reading about C++11 (of which more to come). It’s a technique I wish I’d known about a long time ago, as it addresses an issue I’ve always thought C++ had – forcing you to duplicate code. That issue is addressed even more thoroughly with C++11, which has introduced… Read More »