diff options
author | 2014-06-04 18:47:42 +0200 | |
---|---|---|
committer | 2014-06-04 18:47:42 +0200 | |
commit | 58cfac9a1277f2b2198ed1e5c3190543d1ed95a6 (patch) | |
tree | 8f6c303b2cf39d8a4d590c1cf31e25dda50f7e98 /unsupported/Eigen/CXX11/src/Core/util | |
parent | 45515779d3e6a56aeddebc07b3a18ed006cefaf1 (diff) |
unsupported/ C++11 workarounds: don't use hack for libc++ if not required
libc++ from 3.4 onwards supports constexpr std::get, but only if
compiled with -std=c++1y. Change the detection so that libc++'s
internals are only used if either -std=c++1y is not specified or the
library is too old, making the whole hack a bit more future-proof.
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Core/util')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Core/util/CXX11Workarounds.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/unsupported/Eigen/CXX11/src/Core/util/CXX11Workarounds.h b/unsupported/Eigen/CXX11/src/Core/util/CXX11Workarounds.h index 356ae10cf..d71a67590 100644 --- a/unsupported/Eigen/CXX11/src/Core/util/CXX11Workarounds.h +++ b/unsupported/Eigen/CXX11/src/Core/util/CXX11Workarounds.h @@ -48,13 +48,15 @@ namespace internal { * - libstdc++ from version 4.7 onwards has it nevertheless, * so use that * - libstdc++ older versions: use _M_instance directly - * - libc++ all versions so far: use __elems_ directly + * - libc++ from version 3.4 onwards has it IF compiled with + * -std=c++1y + * - libc++ older versions or -std=c++11: use __elems_ directly * - all other libs: use std::get to be portable, but * this may not be constexpr */ #if defined(__GLIBCXX__) && __GLIBCXX__ < 20120322 #define STD_GET_ARR_HACK a._M_instance[I] -#elif defined(_LIBCPP_VERSION) +#elif defined(_LIBCPP_VERSION) && (!defined(_LIBCPP_STD_VER) || _LIBCPP_STD_VER <= 11) #define STD_GET_ARR_HACK a.__elems_[I] #else #define STD_GET_ARR_HACK std::template get<I, T, N>(a) |