Hey guys,
I'm trying to iterate over an enumeration which contains strings like
the this:
enum FileName : string {
file1 = "file1.ext",
file2 = "file2.ext"
}
I already found this article: http://lists.puremagic.com/pipermail/
digitalmars-d/2007-July/021920.html but it's an enum which contains
in
Nrgyzer Wrote:
> Hey guys,
>
> I'm trying to iterate over an enumeration which contains strings like
> the this:
>
> enum FileName : string {
> file1 = "file1.ext",
> file2 = "file2.ext"
> }
>
> I already found this article: http://lists.puremagic.com/pipermail/
> digitalmars-d/2007-July/021920
== Auszug aus Jesse Phillips (jessekphillip...@gmail.com)'s Artikel
> Nrgyzer Wrote:
> > Hey guys,
> >
> > I'm trying to iterate over an enumeration which contains strings
like
> > the this:
> >
> > enum FileName : string {
> > file1 = "file1.ext",
> > file2 = "file2.ext"
> > }
> >
> > I already fo
On 02/10/2011 08:22 PM, Jesse Phillips wrote:
Nrgyzer Wrote:
Hey guys,
I'm trying to iterate over an enumeration which contains strings like
the this:
enum FileName : string {
file1 = "file1.ext",
file2 = "file2.ext"
}
I already found this article: http://lists.puremagic.com/pipermail/
digit
spir Wrote:
> On 02/10/2011 08:22 PM, Jesse Phillips wrote:
> > enum FileName : string {
> > file1 = "file1.ext",
> > file2 = "file2.ext"
> > }
> >
> > void main(string args[])
> > {
> > foreach(a; __traits(allMembers, FileName))
> > writeln(mixin("FileName." ~ a));
> > }
>
> Why t
On 02/10/2011 11:32 PM, Jesse Phillips wrote:
enum FileName : string {
> > file1 = "file1.ext",
> > file2 = "file2.ext"
> > }
> >
> > void main(string args[])
> > {
> >foreach(a; __traits(allMembers, FileName))
> >writeln(mixin("FileName." ~ a));
> > }
>
> Why
I don't have answers to your other questions.
On 02/10/2011 03:25 PM, spir wrote:
> unittest {
> auto i = 1;
> auto s = "i";
It works if you define s as:
enum s = "i";
> writeln(mixin("i")); // compiler happy up to here --> "1"
> writeln(mixin(s)); // compiler unhappy --> "Error: argument
On 02/11/2011 01:02 AM, Ali Çehreli wrote:
I don't have answers to your other questions.
On 02/10/2011 03:25 PM, spir wrote:
unittest {
auto i = 1;
auto s = "i";
It works if you define s as:
enum s = "i";
writeln(mixin("i")); // compiler happy up to here --> "1"
writeln(mixin(s)); //
spir Wrote:
> But in your example the symbol a does not look like a constant, instead it
> the
> loop variable. Do, how does it work?
Magic.
No really, the best I can tell is that the compiler will try to run the foreach
loop at compile-time if there is something in the body that must be eva
On 02/11/2011 05:27 AM, Jesse Phillips wrote:
spir Wrote:
But in your example the symbol a does not look like a constant, instead it the
loop variable. Do, how does it work?
Magic.
No really, the best I can tell is that the compiler will try to run the foreach
loop at compile-time if there
"Jesse Phillips" wrote in message
news:ij2drt$1mq3$1...@digitalmars.com...
>
> Magic.
>
> No really, the best I can tell is that the compiler will try to run the
> foreach loop at compile-time if there is something in the body that must
> be evaluated at compile time.
>
Actually this happens b
11 matches
Mail list logo