File: lambda-generic-ice2.C

package info (click to toggle)
gcc-arm-none-eabi 15%3A14.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,099,328 kB
  • sloc: cpp: 3,627,108; ansic: 2,571,498; ada: 834,230; f90: 235,082; makefile: 79,231; asm: 74,984; xml: 51,692; exp: 39,736; sh: 33,298; objc: 15,629; python: 15,069; fortran: 14,429; pascal: 7,003; awk: 5,070; perl: 3,106; ml: 285; lisp: 253; lex: 204; haskell: 135
file content (123 lines) | stat: -rw-r--r-- 3,662 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// PR c++/66387
// { dg-do compile { target c++14 } }

namespace boost {
namespace hana {
namespace detail {
namespace std {
using size_t = decltype(0);
}
}
namespace ic_detail {
template <typename T, T> struct _with_index {
  template <typename F> constexpr void operator()(F &&) const;
};
template <typename T, T v> struct _times { _with_index<T, v> with_index; };
}
template <typename T, T v> struct _integral_constant {
  using value_type = T;
  operator value_type() const;
  ic_detail::_times<T, v> times;
};
template <detail::std::size_t i>
constexpr _integral_constant<detail::std::size_t, i> size_t{};
template <typename, typename = void> struct datatype;
}
}
namespace std {
typedef int size_t;
inline namespace __cxx11 {}
}
namespace boost {
namespace hana {
template <bool> struct when;
template <typename, typename, typename> struct to_impl;
template <typename T, typename> struct datatype : datatype<T, when<true>> {};
template <typename T, bool condition> struct datatype<T, when<condition>> {
  using type = typename T::hana::datatype;
};
template <typename> struct _models;
template <typename To, typename From>
    struct to_impl < To,
    From, when < _models<From> {
} >> ;
namespace detail {
namespace std {
template <typename T, T> struct integer_sequence;
template <size_t... n> using index_sequence = integer_sequence<size_t, n...>;
namespace int_seq_detail {
template <size_t> struct make_index_sequence {
  using type = index_sequence<0>;
};
template <typename, typename> struct cast_to;
template <typename T, typename U, U... u>
struct cast_to<T, integer_sequence<U, u...>> {
  using type = integer_sequence<T, u...>;
};
}
template <typename T, T>
using make_integer_sequence = typename int_seq_detail::cast_to<
    T, int_seq_detail::make_index_sequence<1>::type>::type;
}
}
namespace ic_detail {
template <typename T, T N, typename = detail::std::make_integer_sequence<T, N>>
struct go;
template <typename T, T N, T... i>
struct go<T, N, detail::std::integer_sequence<T, i...>> {
  using swallow = T;
  template <typename F> static void with_index(F f) {
    swallow{(f(_integral_constant<T, i>{}), 0)...};
  }
};
template <typename T, T v>
template <typename F>
constexpr void _with_index<T, v>::operator()(F &&f) const {
  go<T, 0>::with_index(f);
}
}
}
}
namespace std {
template <typename> class allocator;
template <class> struct char_traits;
template <typename _CharT, typename = char_traits<_CharT>> class basic_ostream;
namespace __cxx11 {
template <typename _CharT, typename = char_traits<_CharT>,
          typename = allocator<_CharT>>
class basic_stringstream;
}
typedef basic_ostream<char> ostream;
typedef basic_stringstream<char> stringstream;
template <typename, typename> class basic_ostream {};
template <typename _CharT, typename>
class basic_iostream : public basic_ostream<_CharT> {};
namespace __cxx11 {
template <typename _CharT, typename _Traits, typename>
class basic_stringstream : public basic_iostream<_CharT, _Traits> {};
}
}
namespace hana = boost::hana;
template <typename> struct print_impl;
template <typename X> void print(std::ostream os, X x) {
  using Tag = typename hana::datatype<X>::type;
  print_impl<Tag>::apply(os, x);
}
struct Vector;
template <typename, typename> struct vector2 {
  struct hana {
    using datatype = Vector;
  };
  static constexpr std::size_t size = 0;
};
template <> struct print_impl<Vector> {
  template <typename vectorN> static void apply(std::ostream, vectorN) {
    constexpr auto N = hana::size_t<vectorN::size>;
    N.times.with_index([&](auto) { N - hana::size_t<1>; });
  }
};
int main() {
  std::stringstream ss;
  vector2<int, char> v2;
  print(ss, v2);
}