LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
intseq.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #pragma once
10 
11 #include <utility>
12 
13 namespace LC
14 {
15 namespace Util
16 {
17 namespace IntSeq
18 {
19  template<typename T, T... Fst, T... Snd>
20  std::integer_sequence<T, Fst..., Snd...>
21  ConcatImpl (std::integer_sequence<T, Fst...>, std::integer_sequence<T, Snd...>);
22 
23  template<typename... Seqs>
24  struct ConcatS;
25 
26  template<typename... Seqs>
27  using Concat = typename ConcatS<Seqs...>::Type_t;
28 
29  template<typename Seq>
30  struct ConcatS<Seq>
31  {
32  using Type_t = Seq;
33  };
34 
35  template<typename Seq1, typename Seq2, typename... Rest>
36  struct ConcatS<Seq1, Seq2, Rest...>
37  {
38  using Type_t = Concat<decltype (ConcatImpl (Seq1 {}, Seq2 {})), Rest...>;
39  };
40 
41  template<typename T, T E, size_t C>
42  struct RepeatS
43  {
44  template<T... Is>
45  static auto RepeatImpl (std::integer_sequence<T, Is...>)
46  {
47  return std::integer_sequence<T, (static_cast<void> (Is), E)...> {};
48  }
49 
50  using Type_t = decltype (RepeatImpl (std::make_integer_sequence<T, C> {}));
51  };
52 
53  template<typename T, T E, size_t C>
54  using Repeat = typename RepeatS<T, E, C>::Type_t;
55 }
56 }
57 }
LC::Util::IntSeq::ConcatS< Seq >::Type_t
Seq Type_t
Definition: intseq.h:50
LC::Util::IntSeq::RepeatS::RepeatImpl
static auto RepeatImpl(std::integer_sequence< T, Is... >)
Definition: intseq.h:63
LC::Util::IntSeq::ConcatS
Definition: intseq.h:42
LC::Util::IntSeq::Repeat
typename RepeatS< T, E, C >::Type_t Repeat
Definition: intseq.h:72
LC::Util::IntSeq::ConcatImpl
std::integer_sequence< T, Fst..., Snd... > ConcatImpl(std::integer_sequence< T, Fst... >, std::integer_sequence< T, Snd... >)
LC::Util::Fst
constexpr auto Fst
Definition: prelude.h:240
LC::Util::IntSeq::RepeatS
Definition: intseq.h:60
LC
Definition: constants.h:14
LC::Util::IntSeq::RepeatS::Type_t
decltype(RepeatImpl(std::make_integer_sequence< T, C > {})) Type_t
Definition: intseq.h:68
LC::Util::Snd
constexpr auto Snd
Definition: prelude.h:242
LC::Util::IntSeq::Concat
typename ConcatS< Seqs... >::Type_t Concat
Definition: intseq.h:45