In this post (part 2 of 2) we will be implementing tuple. This is a long one (very long, so strap yourself in), and so for the sake of readability I won't be covering all of the source code; only the most important parts will be discussed. Those are, in order of their appearance, new type helpers and traits, the internal representation of tuple, the basics for the constructors for tuple, and the free functions operating on tuples. As always, you can find the complete source code for this post in the GitHub repository.Read More
I have decided to split-up the posts on pairs and tuples so that we don't have one extremely long post. However, both data structures are closely related to one another and so their respective posts will be released more or less at the same time. The code for both is already available on the GitHub repository to check out.
In this post (part 1) we will be implementing pair. In part 2, to be released shortly after this, we will be implementing tuple.Read More
Looking at the plan of action for the first post, which was originally supposed to be titled "pairs, tuples, and integer sequences", I decided that it would be best to start of fast with an implementation of the <utility> header, sans pairs, that way we can also see how move, forward, swap, and exchange are implemented. This is mostly an excuse to publish the first post as quickly as possible, but it also has a few benefits. For one, we'll already have index_sequence implemented for next time when we'll need it for our implementation of tuples. It also has the added benefit of allowing me to get the testing infrastructure up and running. If you take a look at the repository you will see that I have added integration for Travis-CI builds, a Makefile, and some other useful files for testing our implementation.Read More
The Standard Template Library (STL) is the modern C++ programmer's best friend. It contains a wealth of data structures, algorithms, and utility libraries from which we can build almost anything -- but only if we know how to use it correctly and efficiently. However, many people, from both inside and outside the C++ community, lament the large surface area of the STL and the (admittedly) large language specification, claiming that to really understand C++ one needs to be a language-lawyer, if not to have the entire standard memorized. I think this view is mistaken.Read More