www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 435] New: Constructors should be templatized

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=435

           Summary: Constructors should be templatized
           Product: D
           Version: 0.169
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: aarti interia.pl


It is  not possible to make constructors as template functions. As constructor
does not differ so much from function it should not be very difficult to
implement it, but gives lot more flexibility.


-- 
Oct 15 2006
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=435


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei metalanguage.com




--- Comment #1 from Andrei Alexandrescu <andrei metalanguage.com>  2009-05-18
12:31:07 PDT ---
A quick unittest:

class B
{
    this(int) {}
}

class D : B
{
    this(A...)(A args) { super(args); }
}

unittest
{
    auto a = new D(4);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 18 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=435


Steven Schveighoffer <schveiguy yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reiner.pope gmail.com


--- Comment #2 from Steven Schveighoffer <schveiguy yahoo.com> 2010-08-05
10:57:21 PDT ---
*** Issue 1462 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 05 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=435


nfxjfg gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ivan.melnychuk+d gmail.com


--- Comment #3 from nfxjfg gmail.com 2010-09-21 04:59:11 PDT ---
*** Issue 4905 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 21 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=435



--- Comment #4 from Shin Fujishiro <rsinfu gmail.com> 2010-10-25 11:39:57 PDT
---
Created an attachment (id=794)
Patch against dmd trunk r727, for D2

This is a D2 enhancement patch.  Passed dmd/druntime/phobos tests and testcases
in the reports.

class.c:  Just added isTemplateDeclaration() to an if condition.  It makes the
ClassDeclaration recognize constructor templates as its constructors.

expression.c:  Changed toParent() to isThis().  toParent() doesn't check
through template instances and misunderstands that constructor is not declared
inside a class or struct.  isThis() (or toParent2) takes care of such cases.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 25 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=435



--- Comment #5 from sweatygarlic yahoo.co.jp 2011-05-15 09:57:25 PDT ---
Created an attachment (id=973)
this is a modification to initialize const member

this contains the diff of `794: Patch against dmd trunk r727, for D2'

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 15 2011