Re: spawn and wait

2014-07-02 Thread Ali Çehreli via Digitalmars-d-learn
On 07/02/2014 08:29 PM, Puming wrote: > I want to spawn several similar tasks and then wait for all of them to > complete to go on do some other things If you don't care about account for each of them individually, core.thread.thread_joinAll would work. The following program starts two waves o

DUB help plz

2014-07-02 Thread K.K. via Digitalmars-d-learn
I've been trying to figure DUB out and have been having a bit of trouble. I'm trying to make a simple program that uses Derelict GL3 and SDL2. I keep getting this error though: derelict.util.exception.SharedLibLoadException@C:\Users\Kyoji\AppData\Roaming\dub\packages\derelict-util-1.0.1\source\de

spawn and wait

2014-07-02 Thread Puming via Digitalmars-d-learn
Hi, I want to spawn several similar tasks and then wait for all of them to complete to go on do some other things, like: ```d void task(int id) { // do the stuff } void main() { foreach (i; 0..10) { spawn(&task, i); } wait(?); // wait for all task to complete doSomeOtherThings()

Re: CTFE bug or enhancement?

2014-07-02 Thread safety0ff via Digitalmars-d-learn
On Thursday, 3 July 2014 at 02:02:19 UTC, safety0ff wrote: On Thursday, 3 July 2014 at 01:55:14 UTC, safety0ff wrote: Actually, this is an enhancement because adding: enum b = blah Makes them fail. :( The question is now: how can the delegate be evaluated for the return value but not for the

Re: CTFE bug or enhancement?

2014-07-02 Thread safety0ff via Digitalmars-d-learn
On Thursday, 3 July 2014 at 01:55:14 UTC, safety0ff wrote: Actually, this is an enhancement because adding: enum b = blah Makes them fail. :( The question is now: how can the delegate be evaluated for the return value but not for the enum?

Re: CTFE bug or enhancement?

2014-07-02 Thread safety0ff via Digitalmars-d-learn
Actually, this is an enhancement because adding: enum b = blah Makes them fail. :(

CTFE bug or enhancement?

2014-07-02 Thread safety0ff via Digitalmars-d-learn
Everything compiles fine except for function qux2: http://dpaste.dzfl.pl/9d9187e0b450 Is this a bug or an enhancement for CTFE? It would be really nice to have this feature because core.simd has functions such as: void16 __simd(XMM opcode, void16 op1, void16 op2, ubyte imm8); Where all the a

Re: overloading InExpression

2014-07-02 Thread Vlad Levenfeld via Digitalmars-d-learn
Ah yes I never noticed that "in" was in the binary op table. In my defense, searching for "in" usually yields too many results to be useful. Thanks to everyone for your help!

Re: Why is the Win32 boilerplate the way it is?

2014-07-02 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 30 June 2014 at 15:58:50 UTC, Jason King wrote: On Monday, 30 June 2014 at 15:19:39 UTC, Adam D. Ruppe wrote: On Monday, 30 June 2014 at 15:14:24 UTC, Jeremy Sorensen wrote: documentation means "import core.sys.windows.windwos" The Windows headers that come with D are pathetically

Re: overloading InExpression

2014-07-02 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jul 02, 2014 at 02:35:54PM +, Vlad Levenfeld via Digitalmars-d-learn wrote: > On Wednesday, 2 July 2014 at 14:14:57 UTC, Dicebot wrote: > >struct S > >{ > > int opIn_r(int key) > > { > > return key*2; > > } > >} > > > >void main() > >{ > > assert((42 in S.in

Re: Building D on windows

2014-07-02 Thread Kashyap via Digitalmars-d-learn
On Wednesday, 2 July 2014 at 16:24:40 UTC, Vladimir Panteleev wrote: On Wednesday, 2 July 2014 at 16:06:08 UTC, Kashyap wrote: I got the following error - C:\Users\labuser\dlang\druntime>dir ..\dmd\src\vcbuild\Win32\Release\dmd_msc.exe C:\Users\labuser\dlang\druntime>shell script.sh shell 1.

Re: Why is the Win32 boilerplate the way it is?

2014-07-02 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 29 June 2014 at 15:06:25 UTC, Jeremy Sorensen wrote: The only question I have is what happens when you use SUBSYSTEM:WINDOWS:4.0 (Which I understand means XP or higher) and the program runs on something older? Windows XP is version 5.1. 4.0 was Windows NT 4 (which I believe was the

Re: Building D on windows

2014-07-02 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 2 July 2014 at 16:06:08 UTC, Kashyap wrote: I got the following error - C:\Users\labuser\dlang\druntime>dir ..\dmd\src\vcbuild\Win32\Release\dmd_msc.exe C:\Users\labuser\dlang\druntime>shell script.sh shell 1.01 make -f posix.mak DMD=../dmd/src/vcbuild/Win32/Release/dmd_msc.exe

Building D on windows

2014-07-02 Thread Kashyap via Digitalmars-d-learn
Hi, I was able to build dmd on my windows machine using VS2013 (using the vs2010 sln file). However, I am not sure how to proceed with building the druntime and phobos. Could someone please point me to instructions for the same? I tried the following 1. Downloaded make and shell (digital mar

Re: overloading InExpression

2014-07-02 Thread bearophile via Digitalmars-d-learn
Dicebot: Yep, I think it is D1 legacy approach. opBinary should be more appropriate. I hope the usage of the old operator overloading functions will generate deprecation messages soon. Bye, bearophile

Re: overloading InExpression

2014-07-02 Thread Kozzi11 via Digitalmars-d-learn
On Wednesday, 2 July 2014 at 14:35:55 UTC, Vlad Levenfeld wrote: On Wednesday, 2 July 2014 at 14:14:57 UTC, Dicebot wrote: struct S { int opIn_r(int key) { return key*2; } } void main() { assert((42 in S.init) == 84); } Thanks! I wonder, why the

Re: overloading InExpression

2014-07-02 Thread Dicebot via Digitalmars-d-learn
On Wednesday, 2 July 2014 at 15:36:23 UTC, Kozzi11 wrote: Thanks! I wonder, why the _r and lack of documentation? Maybe something from old days? But in current http://dlang.org/operatoroverloading.html#Binary"; target="_blank">doc there is a opBinary: Yep, I think it is D1 legacy approach. op

Re: overloading InExpression

2014-07-02 Thread Ali Çehreli via Digitalmars-d-learn
On 07/02/2014 07:35 AM, Vlad Levenfeld wrote: On Wednesday, 2 July 2014 at 14:14:57 UTC, Dicebot wrote: struct S { int opIn_r(int key) { return key*2; } } void main() { assert((42 in S.init) == 84); } Thanks! I wonder, why the _r I think it is the old syntax, meaning

Re: overloading InExpression

2014-07-02 Thread Vlad Levenfeld via Digitalmars-d-learn
On Wednesday, 2 July 2014 at 14:14:57 UTC, Dicebot wrote: struct S { int opIn_r(int key) { return key*2; } } void main() { assert((42 in S.init) == 84); } Thanks! I wonder, why the _r and lack of documentation?

Re: Can't modify this

2014-07-02 Thread Maxim Fomin via Digitalmars-d-learn
On Saturday, 28 June 2014 at 20:40:21 UTC, Ary Borenszweig wrote: This doesn't work: class Foo { this() { this = new Foo; } } Error: Cannot modify 'this' However you can do this: class Foo { this() { auto p = &this; *p = new Foo(); } } It even changes the value of this!

Re: overloading InExpression

2014-07-02 Thread Dicebot via Digitalmars-d-learn
struct S { int opIn_r(int key) { return key*2; } } void main() { assert((42 in S.init) == 84); }

overloading InExpression

2014-07-02 Thread Vlad Levenfeld via Digitalmars-d-learn
Is this possible? The documentation for std.container lists "in" as an operator in the container API but only associative arrays actually seem to support it.

Re: similar method as Math.Ceiling in c#

2014-07-02 Thread via Digitalmars-d-learn
On Wednesday, 2 July 2014 at 13:36:17 UTC, pgtkda wrote: Is there a similar method as Math.Ceiling in D? http://msdn.microsoft.com/en-US/en-en/library/zx4t0t48(v=vs.110).aspx http://dlang.org/phobos/std_math.html#.ceil

similar method as Math.Ceiling in c#

2014-07-02 Thread pgtkda via Digitalmars-d-learn
Is there a similar method as Math.Ceiling in D? http://msdn.microsoft.com/en-US/en-en/library/zx4t0t48(v=vs.110).aspx

Re: Integer max value

2014-07-02 Thread pgtkda via Digitalmars-d-learn
On Wednesday, 2 July 2014 at 08:58:46 UTC, Rene Zwanenburg wrote: On Wednesday, 2 July 2014 at 08:39:06 UTC, pgtkda wrote: Is there a way to get the max size of an integer? int.max The same exists for other built-ins and enums. thank you very much

Re: Integer max value

2014-07-02 Thread Rene Zwanenburg via Digitalmars-d-learn
On Wednesday, 2 July 2014 at 08:39:06 UTC, pgtkda wrote: Is there a way to get the max size of an integer? int.max The same exists for other built-ins and enums.

Integer max value

2014-07-02 Thread pgtkda via Digitalmars-d-learn
Is there a way to get the max size of an integer?