C++, FTL, Programming

A Different Allocator Model

I originally posted this to #AltDevBlogADay on Saturday 30th July 2011. Quite a few years back I started developing a custom STL implementation which has eventually be adopted and used throughout our company. One of the most important things to get right when developing any kind of generic container library is the way memory is allocated. It [...]

C++, FTL, Programming

Simplifying the Flag Set

In the last few posts, I’ve covered the development of a type safe and easy to use flag set, and as a result it now contains 3 required template parameters, two of which declare default values. template < typename TEnum, int TMaxFlags = 8, typename TNames = union_names<bit_set_size<TMaxFlags>::Value> > class flag_set The last two properties [...]

C++, FTL, Programming

Debugging Type Safe Flags

In the previous post I described how I implemented a type safe, template driven, system for declaring and using flags in C++. But one of the main issues with the solution was not being able to see what flags were set when debugging. Which Flags Are Set? When setting bits to store flags there are [...]

C++, FTL, Programming

A C++ Flag Set Example

As was pointed out in the last post, I... ahem... forgot to actually put down some working examples of the flag set, so I ended up describing something but not actually showing off the final product. So I thought a good start would be to include a few of the flag set unit tests (since [...]

C++, FTL, Programming

Type Safe Flags in C++

Using bits and shifting enums is a pretty standard way of storing and reading flags. It's quick, it's compact and the syntax isn't to difficult to pick up for people who haven't seen it before. But since a bit is only a bit and an enum is only an enum it's far to easy to [...]

FTL, Programming

Deque Memory Management

I've wanted to blog more about our internal STL implementation for a while and one of the interesting things I wanted to cover was how we implemented the STL deque, which I think is a sometimes misunderstood and unfortunately not a very often used container. But first, what is a deque. A good place to start is [...]

FTL, Programming, Unit Testing

Unit Testing an Object with Dependent Behaviour

It would be a good idea to start with a bit of history. In previous posts I've talked about our custom STL implementation which contains a basic vector, but also a fixed::vector which takes a fixed size and allocates all memory within that container (usually on the stack) and cannot increase or decrease in size. [...]