atomgalaxy / isocpp-universal-template-param

We propose a way to spell a universal template parameter kind. This would allow for a generic apply and other higher-order template metafunctions, and certain typetraits.
https://atomgalaxy.github.io/isocpp-universal-template-param/d1985r0.pdf
2 stars 2 forks source link

template (template X<10>)<10>; #47

Open atomgalaxy opened 1 year ago

atomgalaxy commented 1 year ago

Tomasz Kaminski writes:

As a second note, the paer does not mentoin that, but you may need multuple template disambiguation, consider: template int x = 10;

template __any dnt = x;

template<__any X> void foo() { (template (template X)<10>)<10>; }

Note that the above code is well formed for foo. This is first time, when we can provide two template argument lists for a single name.

BengtGustafsson commented 1 year ago

I don't think the parentheses are needed, or indeed legal. Maybe he just introduced them to show how this nests. We already have a typename template double disambiguation example in the proposal, and I added a slightly different template template disambiguation case in issue #40, also involving double template argument lists but the inner template there is a class template so its instance must be disambigated as a typename using a total of three disambiguators (but no parentheses).