Support libc++ as well as libstdc++

Mac OS X 10.9 Mavericks changes the default C++ library from libstdc++ to libc++, which provides C++11 library meaning things need to be moved out of the `tr1` namespace.

In these changes, `#ifdef _LIBCPP_VERSION` is used to detect whether libc++ is being used, and if so, alternative includes are provided.

Additionally, a recent change to `parsmart.cpp` has been reverted due to it causing segmentation faults. I'm not sure if this is a widespread issue, or just a problem when using libc++.

Matt