On Saturday, 23 January 2021 at 19:19:29 UTC, Paul Backus wrote:
On Saturday, 23 January 2021 at 07:17:38 UTC, Виталий Фадеев
wrote:
Where source ?
Where deduction implementation ?
Here:
https://github.com/dlang/dmd/blob/v2.095.0/src/dmd/dtemplate.d#L1308
Thank!
On Saturday, 23 January 2021 at 07:17:38 UTC, Виталий Фадеев
wrote:
Where source ?
Where deduction implementation ?
Here:
https://github.com/dlang/dmd/blob/v2.095.0/src/dmd/dtemplate.d#L1308
On Saturday, 23 January 2021 at 05:54:09 UTC, Виталий Фадеев
wrote:
On Saturday, 23 January 2021 at 05:39:18 UTC, Виталий Фадеев
wrote:
Context:
data + GUI List
Goal:
auto list = new List( data );
I want 'this( T )( T data )' deduction:
class A( T )
{
this( T )( T
On Saturday, 23 January 2021 at 05:54:09 UTC, Виталий Фадеев
wrote:
auto listFactory( T )( T data )
{
return new List!( T )( data );
}
This is the correct way to do it in D; it's annoying, I know.
(Personally, I usually shorten `listFactory` to just `list` to
make the
On Saturday, 23 January 2021 at 05:54:09 UTC, Виталий Фадеев
wrote:
But, how to create class instance with type deduction in usual
way ?
auto list = new List( extensions );
You can't; there's no type deduction for constructors.
On Saturday, 23 January 2021 at 05:39:18 UTC, Виталий Фадеев
wrote:
Context:
data + GUI List
Goal:
auto list = new List( data );
Of course, we can use 'factory':
import std.stdio;
template List( alias T )
{
class List
{
T data;
Context:
data + GUI List
Goal:
auto list = new List( data );
Concept:
class is created in the usual way : new List( data )
store inside the class: T data;
type T deducted : ( T )( T data )
Tried way:
template List( T )
{
class