[Issue 6573] Add isOneOf to std.traits

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 30 04:39:06 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6573


kennytm at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kennytm at gmail.com


--- Comment #3 from kennytm at gmail.com 2011-08-30 04:39:01 PDT ---
I think this should be in std.typetuple, and also can be implemented using
anySatisfy.

    template isOneOf(X, T...) {
       enum isOneOf = anySatisfy!(staticEqualsTo!X, T);
    }

    private template staticEqualsTo(X) {
       template staticEqualsTo(Y) {
          enum staticEqualsTo = isSame!(X, Y);
          // ^ isSame is a private template in std.typetuple.
       }
    }

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


More information about the Digitalmars-d-bugs mailing list