[Issue 1433] New: in array / slice / range / enum / ...
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Aug 19 15:38:31 PDT 2007
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 at digitalmars.com
ReportedBy: christian.hartung at 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.
--
More information about the Digitalmars-d-bugs
mailing list