111
|
1 // PR c++/66937
|
145
|
2 // { dg-do compile { target c++17_only } }
|
131
|
3 // { dg-options "-fconcepts" }
|
111
|
4
|
|
5 #include <tuple>
|
|
6
|
|
7 namespace detail
|
|
8 {
|
|
9 template<typename T, template<typename...> class Sink>
|
|
10 struct copy_tuple_args_impl;
|
|
11
|
|
12 template<typename... Args, template<typename...> class Sink>
|
|
13 struct copy_tuple_args_impl<std::tuple<Args...>, Sink>
|
|
14 {
|
|
15 using type = Sink<Args...>;
|
|
16 };
|
|
17 }
|
|
18
|
|
19 // copy_tuple_args copies the template arguments of a tuple into another template
|
|
20 // copy_tuple_args does not care about constraints whatsoever.
|
|
21 template<typename Tuple, template<typename...> class Sink>
|
|
22 using copy_tuple_args = typename detail::copy_tuple_args_impl<Tuple, Sink>::type;
|
|
23
|
|
24 // A concept of a column
|
|
25 template <typename T>
|
|
26 concept bool Column()
|
|
27 {
|
|
28 return requires()
|
|
29 {
|
|
30 typename T::_name_t;
|
|
31 };
|
|
32 }
|
|
33
|
|
34 // column_list is constrained to Column arguments
|
|
35 template<Column... C>
|
|
36 struct column_list
|
|
37 {
|
|
38 };
|
|
39
|
|
40 // Here are some columns
|
|
41 struct A
|
|
42 {
|
|
43 using _name_t = int;
|
|
44 };
|
|
45
|
|
46 struct B
|
|
47 {
|
|
48 using _name_t = int;
|
|
49 };
|
|
50
|
|
51
|
|
52 int main()
|
|
53 {
|
|
54 using ColumnTuple = std::tuple<A, B>;
|
|
55 using ColumnList = copy_tuple_args<ColumnTuple, column_list>; // This fails, but should not
|
|
56 }
|
|
57
|