String to enum

2010-12-10 Thread useo
Hi, does anyone know how I can cast a string to an enum which also contains strings? For example: enum MyENUM : string { x = "123" y = "456" z = "789" } ... string myString = X; to!(MyENUM)(myString); // Error: cannot implicitly convert expression (_adDupT((& D12TypeInfo_Aya6__initZ),s)) of

dmd compile with imported modules

2011-01-01 Thread useo
Hey guys, I've the following problem... when I write a simple class, for example: ... module myclasses.exampleClass; class exampleClass { void writeHelloWorld() { writeln("Hello World"); } And import myclasses.exampleClass in the following: ... module mainfile; import myclasses.exampleClass;

Re: dmd compile with imported modules

2011-01-02 Thread useo
rdmd has some problems with my lib-files. Instead of rdmd I just tried xfbuild and it works great on windows, but as I can see there is no linux 32 bit version which I would like to use?!

Re: dmd compile with imported modules

2011-01-09 Thread useo
I just compiled xfbuild on 32bit ubuntu, but when I try to compile, I get the following error: Build failed: /usr/include/d/dmd/druntime/import/core/stdc/errno.o: Invalid cross-device link. Does anyone know how to solve this problem?

Re: dmd compile with imported modules

2011-01-09 Thread useo
I solved the problem by copying the source files from my shared vm- folder to my desktop in my vm.

Template for function or delegate (nothing else)

2011-02-09 Thread useo
Is it possible to create a template which only accepts functions or delegates like this example: class Example(T : void function()) { // or ..(T : void delegate()).. T callback; } Where T is a function or a delegate... Thanks for every suggestion!

Re: Template for function or delegate (nothing else)

2011-02-09 Thread useo
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel > On Wed, 09 Feb 2011 14:35:42 -0500, useo wrote: > > Is it possible to create a template which only accepts functions or > > delegates like this example: > > > > class Example(T : void function

Re: Template for function or delegate (nothing else)

2011-02-09 Thread useo
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel > On Wed, 09 Feb 2011 14:35:42 -0500, useo wrote: > > Is it possible to create a template which only accepts functions or > > delegates like this example: > > > > class Example(T : void function

Re: Template for function or delegate (nothing else)

2011-02-09 Thread useo
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel > On Wed, 09 Feb 2011 14:59:33 -0500, useo wrote: > > == Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel > >> On Wed, 09 Feb 2011 14:35:42 -0500, useo wrote: > >> > Is it

Re: Template for function or delegate (nothing else)

2011-02-09 Thread useo
I just have a problem with my variables. For example... my class/template just looks like: class Example(T) if (is(T == delegate) || is(T == function)) { T callback; void setCallback(T cb) { callback = cb; } } This means that I need variables like Example!(void function()) myVar

Re: Template for function or delegate (nothing else)

2011-02-09 Thread useo
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel > On Wed, 09 Feb 2011 16:14:04 -0500, useo wrote: > > I just have a problem with my variables. > > > > For example... my class/template just looks like: > > > > class Example(T) if

Re: Template for function or delegate (nothing else)

2011-02-09 Thread useo
== Auszug aus bearophile (bearophileh...@lycos.com)'s Artikel > useo: > > I just have a problem with my variables. > > > > For example... my class/template just looks like: > > > > class Example(T) if (is(T == delegate) || is(T == function)) > > { >

Re: Template for function or delegate (nothing else)

2011-02-09 Thread useo
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel > On Wed, 09 Feb 2011 16:41:25 -0500, useo wrote: > > == Auszug aus bearophile (bearophileh...@lycos.com)'s Artikel > >> useo: > >> > I just have a problem with my variables. > >&g

Re: Template for function or delegate (nothing else)

2011-02-10 Thread useo
I implemented all I wanted and it works perfectly ;). But I'm using the "if (is(T == delegate) || is(T == function))"- statement in another class/template. class Example(T) if (is(T == delegate) || is(T == function)) { ... } Now, when I declare Example!(void function()) myVar; I always get: Err

Re: Template for function or delegate (nothing else)

2011-02-10 Thread useo
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel > On Thu, 10 Feb 2011 09:09:03 -0500, useo wrote: > > I implemented all I wanted and it works perfectly ;). > > > > But I'm using the "if (is(T == delegate) || is(T == function))"

Re: Template for function or delegate (nothing else)

2011-02-10 Thread useo
== Auszug aus useo (u...@start.bg)'s Artikel > == Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel > > On Thu, 10 Feb 2011 09:09:03 -0500, useo wrote: > > > I implemented all I wanted and it works perfectly ;). > > > > > > Bu

Re: Template for function or delegate (nothing else)

2011-02-10 Thread useo
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel > On Thu, 10 Feb 2011 09:48:14 -0500, useo wrote: > > I created a complete, new file with the following code: > > > > module example; > > > > void main(string[] args) { > > Example!

Multiple opCall's

2011-02-21 Thread useo
Hey guys, I've a small problem implementing multiple opCall()-methods. At first, I've the following interface: interface Invoker { void opCall(uint i); } ... and an abstract class which inherits from the Invoker-interface like the following: abstract class AbstractInvoker : Invoker { priva

Re: Multiple opCall's

2011-02-21 Thread useo
== Auszug aus Mafi (m...@example.org)'s Artikel > Am 21.02.2011 11:18, schrieb useo: > > Hey guys, > > > > I've a small problem implementing multiple opCall()-methods. At first, I've the following interface: > > > > interface Invoker { > >

enum with classes/structs

2011-03-10 Thread useo
Hey guys, is it possible to declare a enum where all entries are instances of a class (or struct), like the following: class a { ... public this(uint i) { ... } ... } enum myEnum : a { entry1 = new a(0); entry2 = new a(1); } ... or does enumerations only support constant-

Re: enum with classes/structs

2011-03-11 Thread useo
== Auszug aus Jonathan M Davis (jmdavisp...@gmx.com)'s Artikel > On Thursday, March 10, 2011 11:28:04 bearophile wrote: > > useo: > > > is it possible to declare a enum where all entries are instances of a > > > > > class (or struct), like the following: &

Interface/abstract constructors

2011-05-16 Thread useo
Hey guys, is there any chance to create an abstract constructor like: abstract class ABC { abstract this(); } DMD always says "...this non-virtual functions cannot be abstract" - when I use an interface like: interface ABC { this(); } I get a similar error: "...constructors, destruct

Clear big AAs

2011-05-31 Thread useo
Hi, I'm trying to clear big associative arrays, but I always get an object error - what I currently doing is: private string[uint] myAA; void main() { fill(myAA); myAA.clear(); fill(myAA); // object.Error: Access Violation } void fill(string[uint] aa) { for (uint i = 0; i < 10_000_

Re: Clear big AAs

2011-06-01 Thread useo
== Auszug aus David Nadlinger (s...@klickverbot.at)'s Artikel > I realize that this might sound strange, but try setting myAA to null > after clear(), this should fix the crash. > David > On 5/31/11 4:00 PM, useo wrote: > > Hi, > > > > I'm trying to clear

Re: Clear big AAs

2011-06-12 Thread useo
> useo: > > Is there anything I forgot to consider? > If the key and values are primitive values or structs of primitive values then you may try another AA implementation that doesn't use the GC. > Bye, > bearophile I tried some different implementations and I also reduce