From b88daeb6977156fd418a2d5778a27f461cecbefc Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Sat, 13 Feb 2016 11:57:41 +0900 Subject: [PATCH] Detect std::integer_sequence availability. It will allow to reuse compiler cache easier. --- .../fusion/support/detail/index_sequence.hpp | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/boost/fusion/support/detail/index_sequence.hpp b/include/boost/fusion/support/detail/index_sequence.hpp index 1b596e72..e86def00 100644 --- a/include/boost/fusion/support/detail/index_sequence.hpp +++ b/include/boost/fusion/support/detail/index_sequence.hpp @@ -12,8 +12,27 @@ #include #include +// GCC5 has O(logN) implementation, see https://gcc.gnu.org/PR66059 . +#if (defined(__cpp_lib_integer_sequence) && __cpp_lib_integer_sequence >= 201304) \ + || (defined(BOOST_LIBSTDCXX_VERSION) \ + && BOOST_LIBSTDCXX_VERSION >= 500000 && __cplusplus >= 201402) +#include +#define BOOST_FUSION_STDLIB_HAS_INTEGER_SEQUENCE +#endif + namespace boost { namespace fusion { namespace detail { +#ifdef BOOST_FUSION_STDLIB_HAS_INTEGER_SEQUENCE + // Use aliasing templates without checking availability, the compiler should work. + template + using index_sequence = std::index_sequence; + + template + struct make_index_sequence + { + using type = std::make_index_sequence; + }; +#else template struct index_sequence { @@ -53,6 +72,7 @@ namespace boost { namespace fusion { namespace detail struct make_index_sequence<0> : index_sequence<> {}; +#endif }}} #endif