Supporting and signature-checking all foreach variations

Ashish Myles marcianx at gmail.com
Sat Feb 25 11:19:11 PST 2012


On Sat, Feb 25, 2012 at 11:37 AM, Alex Rønne Petersen
<xtzgzorex at gmail.com> wrote:
> On 25-02-2012 17:25, Ashish Myles wrote:
>>
>> 1. Since support for foreach can be added in many ways (with
>>   ref/non-ref/const variants), I wanted to check if there was any
>>   signature constraint that could check if the container supports foreach
>>   as above. I looked into the "compiles" traits, but that doesn't work for
>>   statements.
>
> I think std.traits.isIterable(T) is what you want.
>

Great! Now that I know the answer to the first question, it is so easy
to find the answer on google :P .   Technically, I want something like
isIterable(T,Point3); given the definition of isIterable, I can easily
get this functionality.

I am still looking for answers to the second question (which might
indicate a bug in the frontend) and third question whose answer would
be really enlightening if what I requested is possible.


More information about the Digitalmars-d-learn mailing list