Add C++ port

Seems to work on the real-world samples I've looked at and other people might find it useful.