refs #290 added some new predicates and transform functions to use in combination with the iterator adaptors.

This required refactoring index_sequence out of tuple_private.h so it could be used by the predicates.
This commit is contained in:
Mathew Sutcliffe
2014-07-03 19:04:13 +01:00
parent ae4413abdd
commit db453a6232
3 changed files with 134 additions and 21 deletions

View File

@@ -0,0 +1,46 @@
/* Copyright (C) 2014 VATSIM Community / authors
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef BLACKMISC_INDEX_SEQUENCE_H
#define BLACKMISC_INDEX_SEQUENCE_H
#include <tuple>
#include <type_traits>
namespace BlackMisc
{
namespace Private
{
// Inhibit doxygen warnings about missing documentation
//! \cond PRIVATE
// Our own implementation of std::index_sequence (because not implemented by MSVC2013)
template <size_t... Is>
struct index_sequence
{
static const size_t size = sizeof...(Is);
typedef std::tuple<std::integral_constant<size_t, Is>...> tuple_type;
};
template <size_t I, size_t C, size_t... Is>
struct GenSequence
{
typedef typename GenSequence<I + 1, C, Is..., I>::type type;
};
template <size_t C, size_t... Is>
struct GenSequence<C, C, Is...>
{
typedef index_sequence<Is...> type;
};
template <size_t C>
using make_index_sequence = typename GenSequence<0, C>::type;
//! \endcond
} // namespace Private
} // namespace BlackMisc
#endif // guard