Parameters declared as the alias of a template won't accept the arguments of the same type.
ag0aep6g
anonymous at example.com
Mon May 2 22:01:51 UTC 2022
On 02.05.22 22:47, Stanislav Blinov wrote:
> On Monday, 2 May 2022 at 20:16:04 UTC, ag0aep6g wrote:
>> On 02.05.22 21:17, Stanislav Blinov wrote:
>>> On Monday, 2 May 2022 at 16:29:05 UTC, Loara wrote:
>> [...]
>>>> ```d
>>>> template MyAlias(T){
>>>> alias MyAlias = int;
>>>> }
>>>>
>>>> T simp(T)(MyAlias!T val){
>>>> return T.init;
>>>> }
>>>>
>>>> int main(){
>>>> simp(3);//Impossible to deduce T
[...]
> That's not my answer. And it is nonsense, because my answer is - what T
> is irrelevant, MyAlias maps *all* types to int. Therefore `simp` takes
> an int, which is what the caller is passing.
And what does it return?
More information about the Digitalmars-d-learn
mailing list