# Is this std::vector?

Consider this snippet, whose behavior is not surprising at all:

# Why do we require requires requires?

Someone on StackOverflow just asked about the silly-looking requires requires syntax that’s used a few times in the C++2a Working Draft and in the Ranges library implementation. Since I had just written slides on this for my presentation at the NYC C++ meetup last week, and my explanation seemed well-received there, I gave an answer on SO. I’m repeating it verbatim here, for visibility. TLDR: requires requires is not grammatically insane; but it is questionable style, and you should know how to eliminate it from your code. We show all these things by analogy to noexcept(noexcept(...)).

# On choosing the exact right terminology

From How Apollo Flew to the Moon (W. David Woods, 2011). It is July 20, 1969, and the Eagle has just landed:

# The blow-up problem

Von Neumann was consulted by a group who was building a rocket ship to send into outer space. When he saw the incomplete structure, he asked, “Where did you get the plans for this ship?” He was told, “We have our own staff of engineers.” He disdainfully replied: “Engineers! Why, I have completely sewn up the whole mathematical theory of rocketry. See my paper of 1952.”

Well, the group consulted the 1952 paper, completely scrapped their ten-million-dollar structure, and rebuilt the rocket exactly according to Von Neumann’s plans. The minute they launched it, the entire structure blew up.

They angrily called Von Neumann back and said: “We followed your instructions to the letter. Yet when we started it, it blew up! Why?”

Von Neumann replied, “Ah yes; that is technically known as the blow-up problem — I treated that in my paper of 1954.”

# Les Fleurs de Tarbes

A sign at the entrance to the Tarbes public park reads as follows:

IT IS FORBIDDEN TO ENTER THE PARK CARRYING FLOWERS

Here is what happened, more of less (I think): a woman was walking along carrying a rose. The keeper said to her: “You know very well that no one is allowed to pick the flowers.” “I had it when I came in,” the woman answered. “Well, then, no one will be allowed to enter carrying flowers.” …

# Happy birthday, Donald Knuth! and Peaceful Encampments

Today (January 10th) is Donald Knuth’s 81st birthday. Happy birthday, Dr. Knuth!

# 37 percent of HyperRogue’s compilation time is due to std::function

HyperRogue, the most mind-expanding roguelike in existence, is written in C++11 and uses a “unity build” model — every source file is #included into a single translation unit and compiled all in one go. That single compiler invocation takes about 142 seconds on my MacBook.

# Booth on Cassio

When Mixpanel’s lit club did Shakespeare’s Othello, I was reading it out of A New Variorum Edition of Shakespeare, which is full of footnotes collected from other annotated editions — incidentally including some commentary by Coleridge.

# const is a contract

Here’s a slogan that needs more currency:

const is a contract. …

# Should foo be move-only?

Earlier today Vinnie Falco asked if I had an opinion on whether the Networking TS’s CompletionCondition concept should support “move-only” types. I said I don’t even know what CompletionCondition is, so how could I have an opinion on that? But then it turned out that I did have an opinion.

# Against the Grain: Contraception, abortion, and slow death

From Joris-Karl Huysmans’ À rebours (1884), which I highly recommend to anyone with a decadent literary bent. Our protagonist is briefly moved to philosophize on the slings and arrows:

# Against the Grain: Pitcher plant

From Joris-Karl Huysmans’ À rebours (1884), which I highly recommend to anyone with a decadent literary bent. This morning our protagonist has just received a shipment of exotic plants:

# for (auto&& elt : range) Always Works

In my previous post Contra CTAD (2018-12-09), I mentioned that I like things that work 100% of the time, and that I dislike — and strongly recommend against ever using — things that work 99% of the time and then break on the 100th time. In response, Reddit commenter AlexAlabuzhev wrote: “There are no features that work 100% of the time.”

# Don’t inherit from standard types

Puzzle of the day: Here we have two different class types, both of which conceptually wrap up a sequence of integers into something that can be “decremented” (popping the last element) and tested for emptiness via operator bool. The only difference between them is that one is expressed via composition and the other via inheritance.

Today Andrzej Krzemieński posted a really nice blog post on class template argument deduction (CTAD) and std::optional. The key example from “Deducing your Intentions” (2018-12-09) goes like this:
# Don’t put -Weverything in your build flags
What warning flags should you use to compile your project under GCC and/or Clang? Well, everyone should be compiling with -W -Wall (and probably also -Wextra). But some misguided devs are out there compiling with Clang’s -Weverything flag. Stop that!