Debian Codegraph @

yo/advancedtemplates/concepts/examples/constructiblefrom.cc

raw
1 #include <type_traits>
2 #include <string>
3
4 //constructible
5 template <typename Class, typename ...Params>
6 concept Constructible = std::is_constructible<Class, Params ...>::value;
7
8 template <typename Class, typename ...Params>
9 requires Constructible<Class, Params ...>
10 void fun(Class &&type, Params &&...params)
11 {}
12 //=
13
14 int main()
15 {
16 fun(std::string{}, "hello");
17 }