1 #include "VariadicUsing.h"
6 // Ep 48: https://www.youtube.com/watch?v=1gNzhE-Tn40
8 namespace VariadicUsing
10 template<typename
... B
>
13 template<typename
... T
>
14 Merged(T
&& ... t
) : B(forward
<T
>(t
))...
18 using B::operator()...; // It seems not necessary.
21 // Class template argument deduction: https://en.cppreference.com/w/cpp/language/class_template_argument_deduction.
22 template<typename
... T
>
23 Merged(T
...) -> Merged
<decay_t
<T
>...>;
26 void VariadicUsing::tests()
28 // Lambda are standard type.
29 const auto l1
= []() { return 4; };
30 const auto l2
= [](const int i
) { return i
* 10; };
32 Merged
merged(l1
, l2
, [](const double d
) { return d
* 3.2; });
34 cout
<< merged() << endl
;
35 cout
<< merged(10) << endl
;
36 cout
<< merged(10.5) << endl
;