Re: Parameters declared as the alias of a template won't accept the arguments of the same type.

2022-05-02 Thread Elfstone via Digitalmars-d-learn
On Monday, 2 May 2022 at 16:29:05 UTC, Loara wrote: On Sunday, 1 May 2022 at 03:57:12 UTC, Elfstone wrote: [...] Template deduction for aliased function parameter is a very tricky argument and it's not so simple to handle in certain cases. Consider for example this code: ```d template

Re: Parameters declared as the alias of a template won't accept the arguments of the same type.

2022-05-02 Thread Tejas via Digitalmars-d-learn
On Tuesday, 3 May 2022 at 00:38:34 UTC, Tejas wrote: On Monday, 2 May 2022 at 22:01:51 UTC, ag0aep6g wrote: 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

Re: Parameters declared as the alias of a template won't accept the arguments of the same type.

2022-05-02 Thread Tejas via Digitalmars-d-learn
On Monday, 2 May 2022 at 22:01:51 UTC, ag0aep6g wrote: 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){   al

Re: How to remove an element from a dynamic array with given index ?

2022-05-02 Thread Vinod K Chandran via Digitalmars-d-learn
On Monday, 2 May 2022 at 20:50:17 UTC, H. S. Teoh wrote: should be in the same order. How to do it ? int[] data = [ 10, 20, 30, 40, 50 ]; data = data.remove(2); assert(data == [ 10, 20, 40, 50 ]); T Thanks a lot.

Re: Parameters declared as the alias of a template won't accept the arguments of the same type.

2022-05-02 Thread ag0aep6g via Digitalmars-d-learn
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){

Re: Parameters declared as the alias of a template won't accept the arguments of the same type.

2022-05-02 Thread JG via Digitalmars-d-learn
On Monday, 2 May 2022 at 19:17:19 UTC, Stanislav Blinov wrote: On Monday, 2 May 2022 at 16:29:05 UTC, Loara wrote: Template deduction for aliased function parameter is a very tricky argument and it's not so simple to handle in certain cases. Consider for example this code: ```d template

Re: How to remove an element from a dynamic array with given index ?

2022-05-02 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, May 02, 2022 at 08:33:55PM +, Vinod K Chandran via Digitalmars-d-learn wrote: > Hi all, > I have dynamic array and I want to remove an element from it. All I > have the index of the element to remove. And I want to the array > should be in the same order. How to do it ? int[]

Re: Parameters declared as the alias of a template won't accept the arguments of the same type.

2022-05-02 Thread Stanislav Blinov via Digitalmars-d-learn
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(){

Re: Parameters declared as the alias of a template won't accept the arguments of the same type.

2022-05-02 Thread Stanislav Blinov via Digitalmars-d-learn
On Monday, 2 May 2022 at 20:08:48 UTC, Ali Çehreli wrote: On 5/2/22 12:17, Stanislav Blinov wrote: > On Monday, 2 May 2022 at 16:29:05 UTC, Loara wrote: > >> Template deduction for aliased function parameter is a very tricky >> argument and it's not so simple to handle in certain cases. Consider

How to remove an element from a dynamic array with given index ?

2022-05-02 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I have dynamic array and I want to remove an element from it. All I have the index of the element to remove. And I want to the array should be in the same order. How to do it ?

Re: Parameters declared as the alias of a template won't accept the arguments of the same type.

2022-05-02 Thread ag0aep6g via Digitalmars-d-learn
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 Why? That's the

Re: Parameters declared as the alias of a template won't accept the arguments of the same type.

2022-05-02 Thread Ali Çehreli via Digitalmars-d-learn
On 5/2/22 12:17, Stanislav Blinov wrote: > On Monday, 2 May 2022 at 16:29:05 UTC, Loara wrote: > >> Template deduction for aliased function parameter is a very tricky >> argument and it's not so simple to handle in certain cases. Consider >> for example this code: >> >> ```d >> template MyAlia

Re: Parameters declared as the alias of a template won't accept the arguments of the same type.

2022-05-02 Thread Stanislav Blinov via Digitalmars-d-learn
On Monday, 2 May 2022 at 16:29:05 UTC, Loara wrote: Template deduction for aliased function parameter is a very tricky argument and it's not so simple to handle in certain cases. Consider for example this code: ```d template MyAlias(T){ alias MyAlias = int; } T simp(T)(MyAl

Re: Parameters declared as the alias of a template won't accept the arguments of the same type.

2022-05-02 Thread JG via Digitalmars-d-learn
On Monday, 2 May 2022 at 16:29:05 UTC, Loara wrote: On Sunday, 1 May 2022 at 03:57:12 UTC, Elfstone wrote: [...] Template deduction for aliased function parameter is a very tricky argument and it's not so simple to handle in certain cases. Consider for example this code: ```d template

Re: Parameters declared as the alias of a template won't accept the arguments of the same type.

2022-05-02 Thread Loara via Digitalmars-d-learn
On Sunday, 1 May 2022 at 03:57:12 UTC, Elfstone wrote: module test; struct MatrixImpl(S, size_t M, size_t N) { } template Vector(S, size_t N) { alias Vector = MatrixImpl!(S, 1, N); } @nogc S dot1(S, size_t N)(in Vector!(S, N) lhs, in Vector!(S, N) r