Some trivial C++ ports.