What follows is a writeup I did after receiving a question about Contracts, ODR violations, libc++ hardening and their relationships. Since I think it provides a decent explanation of some of the ODR issues we’ve been discussing in WG21, I am sharing more widely. Thanks to Hui Xie and Anthony Williams for the original communication this is extracted from. The context is that libc++ provides…
This post will try to answer a simple question: when is it legit to call std::move twice on the same object? While some people would say “never”, I actually think the answer is more subtle. To capture these subtleties, this article will introduce the concept of move-independence, which I believe to be a useful notion to keep in mind when writing generic libraries. A recent article posted on Reddit…
Recently, I’ve been looking at ways to index into parameter packs with as little compile-time overhead as possible. This is not a new problem, and we know of several metaprogramming techniques to achieve this, some of which offer pretty good compile-times. Most of these techniques are also well documented, for example here and here . So, why write an article about this well-covered topic? Well, I…
I really love GitHub and their product makes my life much easier. Heck, I’m even writing this post from Atom ! But their GitHub Pages redirection is truly broken, and I need a solution. Here’s my problem. My Hana C++ metaprogramming library was accepted into Boost . That’s great, and I’ve been working hard to polish some rough edges and stabilize the interface so it can be shipped with the next…
The goal of this post is to introduce sum types and product types from a very high level perspective, and to try and derive an intuition for what the meaning of tuple<> and variant<> should be. The mathematics in this post are purposefully kept a bit vague, because being more formal would make the post heavier. This post was lifted from an email I was going to send in answer to this message on the…
This (first!) post will present my current understanding of how laziness can be represented as a Comonad. The interest of seeing laziness as a Comonad appeared while working on a C++ metaprogramming library called Hana as a possible generalization of the eval_if construct from the MPL library. More generally, anyone trying to implement a domain-specific language with a notion of branching inside a…