Re: C++ code compiles with libstdc++ but not libc++
Re: C++ code compiles with libstdc++ but not libc++
- Subject: Re: C++ code compiles with libstdc++ but not libc++
- From: Howard Hinnant <email@hidden>
- Date: Wed, 03 Oct 2012 11:40:43 -0400
On Oct 3, 2012, at 11:33 AM, Jean-Denis MUYS <email@hidden> wrote:
> Which symbol can I test to check what version of the standard library is currently under use?
You can test on:
#ifdef _LIBCPP_VERSION
// using libc++
#else
// using libstdc++
#endif
You should include some std C++03 header first before testing this. If you haven't already included such a header and you need to include one gratuitously, my favorite is:
#include <ciso646> // detect std::lib
#ifdef _LIBCPP_VERSION
// using libc++
#else
// using libstdc++
#endif
<ciso646> is dirt cheap to include. The standard actually specifies that it should do nothing. On libstdc++ that's exactly what it does. On libc++ it defines _LIBCPP_VERSION in addition to the standard spec. ;-)
Howard
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden