www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2512] New: ParameterTypeTuple do not support opCall

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

           Summary: ParameterTypeTuple do not support opCall
           Product: D
           Version: 2.021
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Phobos
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: rayerd.wiz gmail.com


The std.traits.ParameterTypeTuple do not support a class object/type and a
struct object/type within opCall.
The ParameterTypeTuple is recommended to be changed like this. 























+++ traits.d.new Sun Dec 14 04:28:31 2008 -93,7 +93,12 */ template ParameterTypeTuple(alias dg) { - alias ParameterTypeTuple!(typeof(dg)) ParameterTypeTuple; + static if (is(dg == class)) + alias ParameterTypeTuple!(dg.opCall) ParameterTypeTuple; + else static if (is(dg == struct)) + alias ParameterTypeTuple!(dg.opCall) ParameterTypeTuple; + else + alias ParameterTypeTuple!(typeof(dg)) ParameterTypeTuple; } /** ditto */ <<<<<<<<<<<<<<<<<<<<<< import std.traits; class C { int opCall(int,double){return 1;} } struct S { int opCall(int,long){return 1;} } void main() { static assert(is(ParameterTypeTuple!(C)[0] == int)); static assert(is(ParameterTypeTuple!(S)[1] == long)); C c; static assert(is(ParameterTypeTuple!(c)[1] == double)); S s; static assert(is(ParameterTypeTuple!(s)[0] == int)); } --
Dec 13 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2512


rayerd.wiz gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|bugzilla digitalmars.com    |rayerd.wiz gmail.com
             Status|NEW                         |ASSIGNED




------- Comment #1 from rayerd.wiz gmail.com  2008-12-13 13:58 -------
Created an attachment (id=282)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=282&action=view)
patch for ParameterTypeTuple


-- 
Dec 13 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2512


Haruki Shigemori <rayerd.wiz gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


--- Comment #2 from Haruki Shigemori <rayerd.wiz gmail.com> 2010-05-19 09:08:52
PDT ---
ParameterTypeTuple supported opCall already.
This code compiles and runs fine on dmd v.2.046.

import std.traits;
class C {
    int opCall(int,double){return 1;}
}
struct S {
    int opCall(int,long){return 1;}
}
void main() {
    static assert(is(ParameterTypeTuple!(C)[0] == int));
    static assert(is(ParameterTypeTuple!(S)[1] == long));
    C c;
    static assert(is(ParameterTypeTuple!(c)[1] == double));
    S s;
    static assert(is(ParameterTypeTuple!(s)[0] == int));
}

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