Writing template requires C ... instead of template ... is just like writing void foo(auto x) requires int(x) ... instead of void foo(int x) ... when declaring a function. Hope they standardize the latter form.
MaceUA well template... and so on still need to be a thing. But yeah, it needs to improve but these are just proposals so far. template looks fine to me though
I think the first form is more versatile. Consider for example that you want to have a type that satisfies more than one concept, like you want to have a default-constructable Bi-Directional container: template requires DefaultConstructable requires BiDirectionalContainer T gimmeMyList(); Or you want to impose restrictions not on the type T itself, but on a type that depends on T: template requires ForwardContainer requires Printable void printAll(const T &myItems); For the case of several concepts, I could imagine a syntax like template But I don't think there would be a natural looking syntax that supports constraints on dependent types (Like T::value_type) in a simmilar way.
Great talk by Walter, as always!
Awesome use of the new word "subsume" which was re-used in another context by the smart questioner at the end : )
As usual very clear presentation. Content is great, slides have the right level of complexity.
Writing
template requires C ...
instead of
template ...
is just like writing
void foo(auto x) requires int(x) ...
instead of
void foo(int x) ...
when declaring a function.
Hope they standardize the latter form.
MaceUA well template... and so on still need to be a thing. But yeah, it needs to improve but these are just proposals so far.
template looks fine to me though
I think the first form is more versatile.
Consider for example that you want to have a type that satisfies more than one concept,
like you want to have a default-constructable Bi-Directional container:
template
requires DefaultConstructable
requires BiDirectionalContainer
T gimmeMyList();
Or you want to impose restrictions not on the type T itself, but on a type that depends on T:
template
requires ForwardContainer
requires Printable
void printAll(const T &myItems);
For the case of several concepts, I could imagine a syntax like
template
But I don't think there would be a natural looking syntax that supports constraints on dependent types (Like T::value_type) in a simmilar way.
Very interesting and well presented, thank you.
wonderful, great talk.
very good talk!
Is there a constant expression ternary operator: "constexpr(a) ? b : c"?
Nope, was thinking about proposing it...
How would the power example be used? What would calling it look like?
Like any normal template function call: power(some_number)
lower level logic, or higher?