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… Continue reading A Different Allocator Model

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… Continue reading Simplifying the Flag Set

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… Continue reading Debugging Type Safe Flags

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… Continue reading A C++ Flag Set Example

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… Continue reading Type Safe Flags in C++

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… Continue reading Deque Memory Management

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.… Continue reading Unit Testing an Object with Dependent Behaviour

FTL

Anatomy of a Smart Pointer

I recently implemented smart pointers into the FTL and was looking for a similar set to Boost's own due to their wide spread use.  Obviously there are a few ways in which smart pointers can be implemented and I thought it would be interesting to document the reasons why I followed a particular route rather… Continue reading Anatomy of a Smart Pointer

FTL

FTL Allocators

Allocators, by anyone's standards, are the most difficult and 'tacked-on' feature of the STL and it is because of this that different implementations have very different opinions on how they should be implemented. Obviously we want the FTL allocator model to be as simple as possible to actively encourage people to create their own custom… Continue reading FTL Allocators

FTL

Fixed Length Containers

It makes sense to start with the simplest and most obvious addition to the standard in the FTL which are fixed length containers. The FTL provides fixed length containers for the vector, queue, stack, bitset and array objects which allow developers to allocate all space for the container on the stack or within the allocation… Continue reading Fixed Length Containers