/* Copyright (C) 2016 * swift Project Community / Contributors * * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, * including this file, may be copied, modified, propagated, or distributed except according to the terms * contained in the LICENSE file. */ //! \file #ifndef BLACKMISC_INTEGERSEQUENCE_H #define BLACKMISC_INTEGERSEQUENCE_H #include #include #include #if ! (defined(Q_CC_GNU) && __GNUC__ <= 4) //! \private #define BLACK_HAS_INTEGER_SEQUENCE #endif namespace BlackMisc { //! \cond PRIVATE namespace Private { #ifdef BLACK_HAS_INTEGER_SEQUENCE template using integer_sequence = std::integer_sequence; template using make_integer_sequence = std::make_integer_sequence; #else // Our own implementation of std::integer_sequence (because not implemented by GCC 4.9) template struct integer_sequence { static const size_t size = sizeof...(Is); typedef std::tuple...> tuple_type; }; template struct GenSequence { typedef typename GenSequence::type type; }; template struct GenSequence { typedef integer_sequence type; }; template using make_integer_sequence = typename GenSequence::type; #endif // ! BLACK_HAS_INTEGER_SEQUENCE template using index_sequence = integer_sequence; template using make_index_sequence = make_integer_sequence; // Remove elements from an index_sequence for which a pack parameter fails to satisfy a given predicate. template struct MaskSequenceImpl { using type = T; }; template struct MaskSequenceImpl, index_sequence, true, Mask...> { using type = typename MaskSequenceImpl, index_sequence, Mask...>::type; }; template struct MaskSequenceImpl, index_sequence, false, Mask...> { using type = typename MaskSequenceImpl, index_sequence, Mask...>::type; }; template using MaskSequence = typename MaskSequenceImpl, Mask...>::type; } // namespace Private //! \endcond } // namespace BlackMisc #endif // guard