C++ fixes to work around clang++/libc++ bugs

Note that this PR will not be tested effectively by travis or our merge builds.  Needs testing on a system with clang 3.3 or 3.3 using libc++ (*not* libstdc++).  This effectively means MacOS 10.9 or FreeBSD 10.