www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1433] New: in array / slice / range / enum / ...

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

           Summary: in array / slice / range / enum / ...
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: spec
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: christian.hartung yahoo.com.br


The in expression can be extended to support things like:

int i;
...

if(i in [1, 2, 3])

or

if(i in [1..5])

or even

enum Color { red, blue, green };
if(i in Color)

It will test for the existence of the element in the container, returning true
if the element is found. If the container is a set of integers, the element
must be an integer. If the set is a string, the element must be a char..
An !in expression also is welcome.

Obs.: also keep the current in expression for associative arrays, returning a
pointer to the element and the opIn and opIn_r.


-- 
Aug 19 2007
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1433


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc



As alternative see bug 6536

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