Today I want to share something about the right way to emulate partial function template specialisation in C++. I learnt it by watching Arthur O’Dwyer’s CppCon talk Template Normal Programming. Actually, the technique for emulating function template partial specialization through class template specialization is well known, but the naming convention used by Arthur is the […]
Metaclasses are a very popular C++ feature that Herb Sutter proposed for the language a couple of weeks ago. I think that metaclasses are a structural change to the language if they are accepted, and this is why you should get familiar with it. The paper dedicates a small subsection on the subject of how […]
A couple of weeks ago, Herb Sutter posted his proposal about metaclasses, triggering a wave of enthusiasm among the C++ community. And for good reason. His proposal gradually introduces the reader to the impressive potential of metaclasses, in particular to improve the expressiveness of current C++ idioms. I think everyone should be aware of the […]
The latest challenge on Fluent C++ wasn’t an easy one. It consisted in finding the best way to use overloaded functions with the STL – or with any other context that accepts functions as parameters, for that matter. You guys submitted solutions that took very different approaches, and this is awesome. Let’s see in details […]
To write good C++ code and master the language, there are a lot of things that you need to know. Practice plays an important role in this, but practice only won’t tell you all. And far from it. The C++ community benefits from a large selection of books, that contain a large part of the […]
Aadam, my esteemed teammate, walked down to me right after reading the last post on Fluent C++, How to Make If Statements More Understandable, with a question. In fact this post made quite a few people think and get back to me with feedback and questions, for which I’m very grateful. If it did just […]
If statements are necessary to build our code. Granted, some ifs are bad, like those that try to emulate polymorphism by testing a series of types. Those, you want to stay away from. But the ones that implement domain rules are good, and even an opportunity to make your code more expressive by showing how […]
After a long wait, the first episode of season 7 of Game of Thrones has come out. It lasted for 59 minutes, and now we have to wait again for the second episode. To fill this void I’m proposing you a C++ challenge to keep ourselves busy until then! This challenge will let you experiment with […]
Now that we’ve got our feet wet and have a feeling of the vector monad in C++, let’s use modern C++ to make a more elaborate implementation of the vector monad, but that leads to cleaner code. You’ll note that the way of thinking here has a lot in common with the optional monad in […]
After having explored how to deal with multiple error handling with the optional monad in C++, let’s take inspiration again from the functional programming world, and see our familiar std::vector from a very unusal perspective. Although this is an application of the concept of monads, we will focus on how to write code in C++, […]