Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:34:43

0001 /*=============================================================================
0002     Copyright (c) 2015 Agustin K-ballo Berge
0003     Copyright (c) 2015 Kohei Takahashi
0004 
0005     Distributed under the Boost Software License, Version 1.0. (See accompanying
0006     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 ==============================================================================*/
0008 
0009 #ifndef BOOST_FUSION_SUPPORT_DETAIL_INDEX_SEQUENCE_06232015_1038
0010 #define BOOST_FUSION_SUPPORT_DETAIL_INDEX_SEQUENCE_06232015_1038
0011 
0012 #include <boost/fusion/support/config.hpp>
0013 #include <cstddef>
0014 
0015 // GCC5 has O(logN) implementation, see https://gcc.gnu.org/PR66059 .
0016 #if (defined(__cpp_lib_integer_sequence) && __cpp_lib_integer_sequence >= 201304) \
0017  || (defined(BOOST_LIBSTDCXX_VERSION) \
0018      && BOOST_LIBSTDCXX_VERSION >= 500000 && __cplusplus >= 201402)
0019 #include <utility>
0020 #define BOOST_FUSION_STDLIB_HAS_INTEGER_SEQUENCE
0021 #endif
0022 
0023 namespace boost { namespace fusion { namespace detail
0024 {
0025 #ifdef BOOST_FUSION_STDLIB_HAS_INTEGER_SEQUENCE
0026     // Use aliasing templates without checking availability, the compiler should work.
0027     template <std::size_t ...Ints>
0028     using index_sequence = std::index_sequence<Ints...>;
0029 
0030     template <std::size_t N>
0031     struct make_index_sequence
0032     {
0033         using type = std::make_index_sequence<N>;
0034     };
0035 #else
0036     template <std::size_t ...Ints>
0037     struct index_sequence
0038     {
0039         typedef std::size_t value_type;
0040 
0041         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0042         static std::size_t size() BOOST_NOEXCEPT
0043         { return sizeof...(Ints); }
0044 
0045         // non standard extension
0046         typedef index_sequence type;
0047     };
0048 
0049     template <typename Left, typename Right>
0050     struct _make_index_sequence_join;
0051 
0052     template <std::size_t... Left, std::size_t... Right>
0053     struct _make_index_sequence_join<
0054         index_sequence<Left...>, index_sequence<Right...>
0055     > : index_sequence<Left..., (sizeof...(Left) + Right)...>
0056     {};
0057 
0058     template <std::size_t N>
0059     struct make_index_sequence
0060       : _make_index_sequence_join<
0061             typename make_index_sequence<N / 2>::type
0062           , typename make_index_sequence<N - N / 2>::type
0063         >
0064     {};
0065 
0066     template <>
0067     struct make_index_sequence<1>
0068       : index_sequence<0>
0069     {};
0070 
0071     template <>
0072     struct make_index_sequence<0>
0073       : index_sequence<>
0074     {};
0075 #endif
0076 }}}
0077 
0078 #endif
0079