Skip to content
Why is a raven like a writing desk?

Thoughts both confusing and enlightening.

Why is a raven like a writing desk?

Thoughts both confusing and enlightening.

Month: April 2015

Recursive lambdas

elbeno, 16 April, 201530 June, 2015

One can assign a lambda to auto or to std::function. Normally one would assign a lambda to auto to avoid possible unwanted allocation from std::function. But if you want recursion, you need to be able to refer to the lambda variable inside the lambda, and you can’t do that if…

Rules for using <random>

elbeno, 8 April, 20153 June, 2025

These days, it’s easy to do the right thing. Don’t do this: Don’t use std::rand(). Ever. Don’t use std::random_shuffle() to permute containers. (Too easy to misuse; can use std::rand() under the hood.) Don’t use any kind of clock for a seed. Don’t use mod (%) to get a random value…

C++ Tuples: the missing functionality

elbeno, 6 April, 201530 June, 2015

C++ provides a strange mix of compile-time and runtime functionality for dealing with tuples. There are some interesting parts, like std::tie to destructure a tuple, and std::tuple_cat to join together several tuples into one. So there is evidence that the standard has been influenced by some functional programming ideas, but…

©2026 Why is a raven like a writing desk? | WordPress Theme by SuperbThemes