How to realize copyable/postblit class

2015-06-12 Thread SimonN via Digitalmars-d-learn
Hi, I have a few classes with need for deeper copying. I don't want a bitwise copy necessarily. Ideally, I'd implement this(this). I've thought about changing them to struct. However, the type feels much more like a D class than a D struct. It's often passed by reference, and it's not plain

Re: Conditional Compilation Multiple Versions

2015-06-12 Thread bitwise via Digitalmars-d-learn
On Fri, 12 Jun 2015 20:55:51 -0400, Márcio Martins wrote: I know... I too hate that one can't use simple logic ops... Indeed... Thanks. Bit

Re: Conditional Compilation Multiple Versions

2015-06-12 Thread via Digitalmars-d-learn
On Saturday, 13 June 2015 at 00:42:00 UTC, bitwise wrote: Is there a way to compile for multiple conditions? version(One) version = OneOrTwo; else version(Two) version = OneOrTwo; version(OneOrTwo) { writeln("moo"); } --- version(One) version(Two) version = OneAndTwo; version(OneAndTwo)

Re: Conditional Compilation Multiple Versions

2015-06-12 Thread Mike Parker via Digitalmars-d-learn
On 6/13/2015 9:41 AM, bitwise wrote: Is there a way to compile for multiple conditions? Tried all these: version(One | Two){ } version(One || Two){ } version(One && Two){ } version(One) | version(Two){ } version(One) || version(Two){ } version(One) && version(Two){ } Bit // config.d vers

Conditional Compilation Multiple Versions

2015-06-12 Thread bitwise via Digitalmars-d-learn
Is there a way to compile for multiple conditions? Tried all these: version(One | Two){ } version(One || Two){ } version(One && Two){ } version(One) | version(Two){ } version(One) || version(Two){ } version(One) && version(Two){ } Bit

Re: How to pass voldemort types to functions

2015-06-12 Thread Ali Çehreli via Digitalmars-d-learn
On 06/12/2015 03:46 PM, kerdemdemir wrote: >> void foo(R)(R range) >> if (isInstanceOf!(Tuple, ElementType!R))// <-- optional >> { > I am also happy to learn optional static if . Actually, it is not 'static if' but a template constraint. It is optional because everything will work with

Re: Reading array of integers readln performance issues

2015-06-12 Thread kerdemdemir via Digitalmars-d-learn
Thanks a lot for your great advices and exaamples. Yes if I don't return; web-site won't show it as "wrong answer". As a learner I am very happy with the responsiveness of the community. Regards

Re: How to pass voldemort types to functions

2015-06-12 Thread kerdemdemir via Digitalmars-d-learn
void foo(R)(R range) if (isInstanceOf!(Tuple, ElementType!R))// <-- optional { Ali thanks a lot. I don't believe I didn't simply try your way. It works. I am also happy to learn optional static if . Your examples are really useful for me. Next time I will share whole code. Thanks

Re: How to pass voldemort types to functions

2015-06-12 Thread Ali Çehreli via Digitalmars-d-learn
On 06/12/2015 03:19 PM, kerdemdemir wrote: Hi; I have tuples created by std.algorithm.group function. auto tupleB = stringB.group(); I need to write a a function which takes tubleB and do some cool stuff. If I don't use a function and write all code below .group() everytihng works but

How to pass voldemort types to functions

2015-06-12 Thread kerdemdemir via Digitalmars-d-learn
Hi; I have tuples created by std.algorithm.group function. auto tupleB = stringB.group(); I need to write a a function which takes tubleB and do some cool stuff. If I don't use a function and write all code below .group() everytihng works but for reusing the code I want to call a f

Re: Qualified destructors / immutable objects

2015-06-12 Thread via Digitalmars-d-learn
On Friday, 12 June 2015 at 15:36:22 UTC, anonymous wrote: no need for ~this() to modify immutable data: I think that's a another bug related to init values.

Re: Qualified destructors / immutable objects

2015-06-12 Thread anonymous via Digitalmars-d-learn
no need for ~this() to modify immutable data: class C { int a; this(int a) { this.a = a; } } struct S { C elem = new C(42); } void main() { import std.stdio; immutable(S) s1; // Error: cannot modify immutable expression s1.e

Re: AMD & Windows 7

2015-06-12 Thread Chris via Digitalmars-d-learn
On Friday, 12 June 2015 at 14:55:15 UTC, Benjamin Thaut wrote: On Friday, 12 June 2015 at 14:39:55 UTC, Chris wrote: I wish it were an error in the Python code so I could fix it, but it works on all other machines (at least those with Intel). It's only on the HP625 with AMD that this error o

Re: Qualified destructors / immutable objects

2015-06-12 Thread anonymous via Digitalmars-d-learn
I cannot find a way to actually modify immutable memory with it... a.d: class C { int a; this(int a) { this.a = a; } } struct S { int x; C elem = new C(42); ~this() { import std.stdio; writeln("mutable ~this()"); x = 1; elem.a = 123;

Re: AMD & Windows 7

2015-06-12 Thread Benjamin Thaut via Digitalmars-d-learn
On Friday, 12 June 2015 at 14:39:55 UTC, Chris wrote: I wish it were an error in the Python code so I could fix it, but it works on all other machines (at least those with Intel). It's only on the HP625 with AMD that this error occurs. Another DLL (which isn't mine) also failed to load, altho

Re: AMD & Windows 7

2015-06-12 Thread Chris via Digitalmars-d-learn
On Friday, 12 June 2015 at 14:20:58 UTC, Alex Parrill wrote: On Friday, 12 June 2015 at 13:16:32 UTC, Chris wrote: On Friday, 12 June 2015 at 12:41:23 UTC, weaselcat wrote: On Friday, 12 June 2015 at 10:54:46 UTC, Chris wrote: Has anyone run into problems with D on AMD processors? I'm talking

Re: AMD & Windows 7

2015-06-12 Thread Alex Parrill via Digitalmars-d-learn
On Friday, 12 June 2015 at 13:16:32 UTC, Chris wrote: On Friday, 12 June 2015 at 12:41:23 UTC, weaselcat wrote: On Friday, 12 June 2015 at 10:54:46 UTC, Chris wrote: Has anyone run into problems with D on AMD processors? I'm talking about Windows 7 on a HP625 laptop in particular. Can you be

Re: AMD & Windows 7

2015-06-12 Thread Chris via Digitalmars-d-learn
On Friday, 12 June 2015 at 12:41:23 UTC, weaselcat wrote: On Friday, 12 June 2015 at 10:54:46 UTC, Chris wrote: Has anyone run into problems with D on AMD processors? I'm talking about Windows 7 on a HP625 laptop in particular. Can you be any more specific? What kind of problems? A DLL in D

Re: AMD & Windows 7

2015-06-12 Thread weaselcat via Digitalmars-d-learn
On Friday, 12 June 2015 at 10:54:46 UTC, Chris wrote: Has anyone run into problems with D on AMD processors? I'm talking about Windows 7 on a HP625 laptop in particular. Can you be any more specific? What kind of problems?

Re: AMD & Windows 7

2015-06-12 Thread Rikki Cattermole via Digitalmars-d-learn
On 12/06/2015 10:54 p.m., Chris wrote: Has anyone run into problems with D on AMD processors? I'm talking about Windows 7 on a HP625 laptop in particular. Have you checked the issue tracker?

Qualified destructors / immutable objects

2015-06-12 Thread via Digitalmars-d-learn
struct S { int x; ~this() { import std.stdio; writeln("mutable ~this()"); x = 1; } } void main() { const(S) s1; immutable(S) s2; } Prints: mutable ~this() mutable ~this() This looks very wrong,

AMD & Windows 7

2015-06-12 Thread Chris via Digitalmars-d-learn
Has anyone run into problems with D on AMD processors? I'm talking about Windows 7 on a HP625 laptop in particular.

Re: What is D's minimum requirements on Mac?

2015-06-12 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-06-10 20:55, Adam D. Ruppe wrote: I'm still tempted to grab a used Mac so I can port my display stuff to Cocoa and test it, but Macs are outrageously expensive and I hate them, so want to spend as little as possible. What does dmd minimally require on a mac? If I got like a 10.5 would th

Re: What is D's minimum requirements on Mac?

2015-06-12 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-06-10 20:55, Adam D. Ruppe wrote: i'm considering something like http://www.amazon.com/Apple-MB138LL-Intel-Drive-Combo/dp/B0006HU49Y/ref=sr_1_5?ie=UTF8&qid=1433962021&sr=8-5&keywords=used+mac+mini You can look up the requirements for OS X and see which is the latest version you can ru