Date: Fri, 19 Nov 2021 17:35:14 +0100

I think I understand what you are meaning by transparent and why our discussion goes in circles.

You are saying that alias templates are transparent as at the time of their definition, they explicitly state what type of alias they are.

But with my proposal, the subsequent specializations would introduce dependent types in a non transparent manner.

Nicolas

Sent from my iPhone

> On 19 Nov 2021, at 17:13, Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]> wrote:

>

>

>> On Fri, Nov 19, 2021 at 10:58 AM Nicolas Weidmann <n.weidmann_at_[hidden]> wrote:

>

>> All I am saying is that alias templates are not as transparent to type deduction as written in your first response.

>

> Yes, they are.

> Dependent member types are (always?) non-transparent "firewalls" against deduction, but aliases are never(!) firewalls.

>

> template<class T> using A1 = T*;

> template<class T> using A2 = std::vector<T>&;

> template<class T> using A3 = std::vector<T>::iterator;

> template<class T> using A4 = std::identity<T>::type;

>

> template<class T> void a1(A1<T>); // transparently equivalent to `a1(T*)`

> template<class T> void a2(A2<T>); // transparently equivalent to `a2(std::vector<T>&)`

> template<class T> void a3(A3<T>); // transparently equivalent to `a3(std::vector<T>::iterator)`

> template<class T> void a4(A4<T>); // transparently equivalent to `a4(std::identity<T>::type)`

>

> In a1 and a2 (no matter which syntax you use to write them), the function parameter contributes to deduction of T.

> In a3 and a4 (no matter which syntax you use to write them), the function parameter won't contribute to deduction of T, because there's a "firewall" dependent member type involved.

>

> HTH,

> Arthur

You are saying that alias templates are transparent as at the time of their definition, they explicitly state what type of alias they are.

But with my proposal, the subsequent specializations would introduce dependent types in a non transparent manner.

Nicolas

Sent from my iPhone

> On 19 Nov 2021, at 17:13, Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]> wrote:

>

>

>> On Fri, Nov 19, 2021 at 10:58 AM Nicolas Weidmann <n.weidmann_at_[hidden]> wrote:

>

>> All I am saying is that alias templates are not as transparent to type deduction as written in your first response.

>

> Yes, they are.

> Dependent member types are (always?) non-transparent "firewalls" against deduction, but aliases are never(!) firewalls.

>

> template<class T> using A1 = T*;

> template<class T> using A2 = std::vector<T>&;

> template<class T> using A3 = std::vector<T>::iterator;

> template<class T> using A4 = std::identity<T>::type;

>

> template<class T> void a1(A1<T>); // transparently equivalent to `a1(T*)`

> template<class T> void a2(A2<T>); // transparently equivalent to `a2(std::vector<T>&)`

> template<class T> void a3(A3<T>); // transparently equivalent to `a3(std::vector<T>::iterator)`

> template<class T> void a4(A4<T>); // transparently equivalent to `a4(std::identity<T>::type)`

>

> In a1 and a2 (no matter which syntax you use to write them), the function parameter contributes to deduction of T.

> In a3 and a4 (no matter which syntax you use to write them), the function parameter won't contribute to deduction of T, because there's a "firewall" dependent member type involved.

>

> HTH,

> Arthur

Received on 2021-11-19 10:35:23