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

@@ -6,6 +6,7 @@
#ifndef BLACKMISC_TUPLE_PRIVATE_H
#define BLACKMISC_TUPLE_PRIVATE_H
#include "index_sequence.h"
#include <QtGlobal>
#include <QDBusArgument>
#include <QHash>
@@ -55,26 +56,6 @@ namespace BlackMisc
return 0;
}
// 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;
// Create an index_sequence containing indices which match a given predicate.
template <class P, size_t I, size_t C, bool B = false, size_t I2 = 0xDeadBeef, size_t... Is>
struct GenSequenceOnPredicate;