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(...)).

Read More

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.”

Read More

Les Fleurs de Tarbes

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


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.” …

Read More

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.

Read More

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.”

Read More