Re: howto count lines - fast

2017-06-03 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2017-06-02 at 10:32 -0700, H. S. Teoh via Digitalmars-d-learn wrote: > […] > > Also, compiler implementors do still have to do the "heroics", or > rather, teach the compiler to do the "heroics" when compiling > straightforward code. So while the general programmer probably will > have >

Re: Creating and loading D plugins in D app

2017-06-03 Thread aberba via Digitalmars-d-learn
On Friday, 2 June 2017 at 16:36:34 UTC, H. S. Teoh wrote: On Fri, Jun 02, 2017 at 12:19:48PM +, Adam D. Ruppe via Digitalmars-d-learn wrote: On Friday, 2 June 2017 at 11:09:05 UTC, aberba wrote: > 1. Get shared libs to work in D (the best approach for all D > code) I have done very

Re: difference between x = Nullable.init and x.nullify

2017-06-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, June 03, 2017 05:52:55 vit via Digitalmars-d-learn wrote: > Hello, > What's the difference between x = Nullable!Test.init and > x.nullify? > > > class Test{} > > void test()pure nothrow{ > Nullable!Test x; > > x = Nullable!Test.init; //OK > x.nullify;

Re: difference between x = Nullable.init and x.nullify

2017-06-03 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 3 June 2017 at 08:01:14 UTC, Jonathan M Davis wrote: On Saturday, June 03, 2017 06:41:44 Stanislav Blinov via Digitalmars-d-learn wrote: On Saturday, 3 June 2017 at 06:19:29 UTC, Jonathan M Davis wrote: > looking at what rt_finalize does, I don't see why it > couldn't be nothrow.

Re: difference between x = Nullable.init and x.nullify

2017-06-03 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 3 June 2017 at 06:19:29 UTC, Jonathan M Davis wrote: looking at what rt_finalize does, I don't see why it couldn't be nothrow. So, unless I'm missing something, it seems like that would be a good enhancement. - Jonathan M Davis Presently, rt_finalize cannot be made nothrow, or

Re: Creating and loading D plugins in D app

2017-06-03 Thread aberba via Digitalmars-d-learn
On Friday, 2 June 2017 at 16:36:34 UTC, H. S. Teoh wrote: On Fri, Jun 02, 2017 at 12:19:48PM +, Adam D. Ruppe via Digitalmars-d-learn wrote: [...] [...] This is not directly related to the OP's question, but recently I wrote a program that, given a user-specified string, transforms it

Re: difference between x = Nullable.init and x.nullify

2017-06-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, June 03, 2017 06:41:44 Stanislav Blinov via Digitalmars-d-learn wrote: > On Saturday, 3 June 2017 at 06:19:29 UTC, Jonathan M Davis wrote: > > looking at what rt_finalize does, I don't see why it couldn't > > be nothrow. So, unless I'm missing something, it seems like > > that would

Re: D scripting in D

2017-06-03 Thread rikki cattermole via Digitalmars-d-learn
On 03/06/2017 10:03 AM, Mike B Johnson wrote: On Saturday, 3 June 2017 at 00:02:54 UTC, Lewis wrote: On Friday, 2 June 2017 at 20:47:31 UTC, Mike B Johnson wrote: [...] For sure. I actually want to post the source code at some point, but the changes I made are very much set up specifically

Re: D scripting in D

2017-06-03 Thread Mike B Johnson via Digitalmars-d-learn
On Saturday, 3 June 2017 at 00:02:54 UTC, Lewis wrote: On Friday, 2 June 2017 at 20:47:31 UTC, Mike B Johnson wrote: [...] For sure. I actually want to post the source code at some point, but the changes I made are very much set up specifically for this project. I'll sift through at some

Re: Creating and loading D plugins in D app

2017-06-03 Thread Patrick Schluter via Digitalmars-d-learn
On Saturday, 3 June 2017 at 09:41:58 UTC, aberba wrote: On Friday, 2 June 2017 at 16:36:34 UTC, H. S. Teoh wrote: On Fri, Jun 02, 2017 at 12:19:48PM +, Adam D. Ruppe via Digitalmars-d-learn wrote: On Friday, 2 June 2017 at 11:09:05 UTC, aberba wrote: > 1. Get shared libs to work in D (the

Re: C macros vs D can't do the right thing

2017-06-03 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 3 June 2017 at 13:17:46 UTC, Russel Winder wrote: A stripped down problem to avoid fluff. The C macro: #define FLOB(t) (sizeof(t)) Can be used in another macro: #define THINGY(a, b) (_THING(a, FLOB(b))) We can use this as in: THINGY(10, __u32) Now the D Way says

Re: std.path.buildPath

2017-06-03 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-06-03 16:12, Russel Winder via Digitalmars-d-learn wrote: From the manual page on std.path.buildPath: writeln(buildPath("foo", "bar", "baz")); // "foo/bar/baz" writeln(buildPath("/foo/", "bar/baz")); // "/foo/bar/baz" writeln(buildPath("/foo", "/bar")); // "/bar" I have no

Re: C macros vs D can't do the right thing

2017-06-03 Thread David Nadlinger via Digitalmars-d-learn
On Saturday, 3 June 2017 at 14:19:00 UTC, Jacob Carlborg wrote: Perhaps using the variadic template with a constraint on one element trick will work. Ugly, but I think that will work. We could also finally fix the frontend to get around this. At DConf 2015, Walter officially agreed that this

Re: Lazy evaluation and @nogc code

2017-06-03 Thread Basile B. via Digitalmars-d-learn
On Saturday, 3 June 2017 at 14:34:41 UTC, Nick Vitsas wrote: In any case, do you think that `scope` should allow for such code to compile? Since you can get the desired result using the verbose version, I think you should also be able to using the `lazy` construct. I think so. There's even a

Re: C macros vs D can't do the right thing

2017-06-03 Thread ketmar via Digitalmars-d-learn
Russel Winder wrote: Now the D Way says... ..use templates! ;-) it is not really possible to guess what macro author means (to do that, dstep should be able to actually *understand* the code), so it tries to do what is used more often. that is, it's dstep failed guess.

std.path.buildPath

2017-06-03 Thread Russel Winder via Digitalmars-d-learn
From the manual page on std.path.buildPath: writeln(buildPath("foo", "bar", "baz")); // "foo/bar/baz" writeln(buildPath("/foo/", "bar/baz")); // "/foo/bar/baz" writeln(buildPath("/foo", "/bar")); // "/bar" I have no idea what drugs the person who chose that last one to be correct

Strange expression found in std.variant

2017-06-03 Thread Francis Nixon via Digitalmars-d-learn
When looking at std.variant I found the following line: return q{ static if (allowed!%1$s && T.allowed!%1$s) if (convertsTo!%1$s && other.convertsTo!%1$s) return VariantN(get!%1$s %2$s other.get!%1$s); }.format(tp, op); I was wondering what exactly the % signs where

Re: Strange expression found in std.variant

2017-06-03 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 3 June 2017 at 16:22:33 UTC, Francis Nixon wrote: When looking at std.variant I found the following line: return q{ static if (allowed!%1$s && T.allowed!%1$s) if (convertsTo!%1$s && other.convertsTo!%1$s) return VariantN(get!%1$s %2$s other.get!%1$s);

Re: Strange expression found in std.variant

2017-06-03 Thread Igor Shirkalin via Digitalmars-d-learn
On Saturday, 3 June 2017 at 16:22:33 UTC, Francis Nixon wrote: When looking at std.variant I found the following line: return q{ static if (allowed!%1$s && T.allowed!%1$s) if (convertsTo!%1$s && other.convertsTo!%1$s) return VariantN(get!%1$s %2$s other.get!%1$s);

Re: Strange expression found in std.variant

2017-06-03 Thread Basile B. via Digitalmars-d-learn
On Saturday, 3 June 2017 at 16:22:33 UTC, Francis Nixon wrote: When looking at std.variant I found the following line: return q{ static if (allowed!%1$s && T.allowed!%1$s) if (convertsTo!%1$s && other.convertsTo!%1$s) return VariantN(get!%1$s %2$s other.get!%1$s);

Re: D scripting in D

2017-06-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 3 June 2017 at 05:04:24 UTC, Russel Winder wrote: Not enough is made of rdmd. rdmd needs to be separated from dmd so it works with gdc and ldc2. rdmd has always worked with them, at least with their gdmd and ldmd wrappers https://github.com/dlang/tools/blob/master/rdmd.d#L46

Re: C macros vs D can't do the right thing

2017-06-03 Thread ketmar via Digitalmars-d-learn
Jacob Carlborg wrote: Perhaps using the variadic template with a constraint on one element trick will work. Ugly, but I think that will work. yeah. that's what Phobos does, for example.

Re: C macros vs D can't do the right thing

2017-06-03 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-06-03 16:03, Nicholas Wilson wrote: I think an alias template parameter will work here as aliases take anything(types, literals, symbols). No, it doesn't work for types: void foo(alias a)() {} void main() { foo!(int)(); } Results in: Error: template instance foo!int does not

Re: RAII pointers

2017-06-03 Thread Russel Winder via Digitalmars-d-learn
Thanks to Moritz and Stanislav for their examples, most useful. There are similarities (which I have just taken :-) but also some differences. Would one be considered more idiomatic D, or is it a question of different circumstances different approaches. The differences are mainly in construction I

C macros vs D can't do the right thing

2017-06-03 Thread Russel Winder via Digitalmars-d-learn
A stripped down problem to avoid fluff. The C macro: #define FLOB(t) (sizeof(t)) Can be used in another macro: #define THINGY(a, b) (_THING(a, FLOB(b))) We can use this as in: THINGY(10, __u32) Now the D Way says use functions not macros. except that size_t FLOB(T)(auto ref

Re: difference between x = Nullable.init and x.nullify

2017-06-03 Thread Kagamin via Digitalmars-d-learn
On Saturday, 3 June 2017 at 06:19:29 UTC, Jonathan M Davis wrote: Assigning Nullable!Test.init is equivalent to setting the internal value to Test.init and setting _isNull to false. Eh? Does it mean Nullable is default initialized to some non-null default value?

Re: D scripting in D

2017-06-03 Thread rikki cattermole via Digitalmars-d-learn
On 03/06/2017 4:43 PM, Lewis wrote: On Saturday, 3 June 2017 at 09:28:03 UTC, rikki cattermole wrote: A lot of this can be done by simply implementing shared libraries fully on Windows. There is a reason why TypeInfo doesn't cross the dll boundary right now. Sadly it isn't a high priority (and

Re: D scripting in D

2017-06-03 Thread Russel Winder via Digitalmars-d-learn
On Sat, 2017-06-03 at 17:08 +, Adam D. Ruppe via Digitalmars-d- learn wrote: > On Saturday, 3 June 2017 at 05:04:24 UTC, Russel Winder wrote: > > Not enough is made of rdmd. rdmd needs to be separated from dmd  > > so it works with gdc and ldc2. > > rdmd has always worked with them, at least

Re: D scripting in D

2017-06-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 3 June 2017 at 17:24:08 UTC, Russel Winder wrote: So why isn't rdmd shipped as a separate thing if it can wrap any of the three compilers? it is... the link above is all there is to it, you simply compile it. The docs also call it a download: http://dlang.org/rdmd.html dmd just

Re: C macros vs D can't do the right thing

2017-06-03 Thread David Nadlinger via Digitalmars-d-learn
On Saturday, 3 June 2017 at 13:17:46 UTC, Russel Winder wrote: Is this a problem in D or a problem in DStep? It's a limitation of DStep – for that use case, it would need to transform one of the macro arguments into a template argument rather than a runtime function parameter. If you need

Re: difference between x = Nullable.init and x.nullify

2017-06-03 Thread vit via Digitalmars-d-learn
On Saturday, 3 June 2017 at 06:19:29 UTC, Jonathan M Davis wrote: [...] thanks

Lazy evaluation and @nogc code

2017-06-03 Thread Nick Vitsas via Digitalmars-d-learn
Hello, I've been playing around with the idea of lazy evaluation for function arguments [1] and I really like how it can be used to simplify deep nested loops operating on structured data. It also seems that you can get quite far without invoking the GC using the `scope` keyword. I’ve been

Re: C macros vs D can't do the right thing

2017-06-03 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-06-03 16:22, David Nadlinger wrote: We could also finally fix the frontend to get around this. At DConf 2015, Walter officially agreed that this is a bug that needs fixing. ;) That would be nice. -- /Jacob Carlborg

Re: std.path.buildPath

2017-06-03 Thread David Nadlinger via Digitalmars-d-learn
On Saturday, 3 June 2017 at 14:12:03 UTC, Russel Winder wrote: I have no idea what drugs the person who chose that last one to be correct semantics was on at the time, but it was some seriously bad stuff. Of all people, I certainly didn't expect you to stray so far from the tone appropriate

Re: D scripting in D

2017-06-03 Thread Lewis via Digitalmars-d-learn
On Saturday, 3 June 2017 at 09:28:03 UTC, rikki cattermole wrote: A lot of this can be done by simply implementing shared libraries fully on Windows. There is a reason why TypeInfo doesn't cross the dll boundary right now. Sadly it isn't a high priority (and it really really needs to be "just

Re: How to Compare 2 objects of the same class

2017-06-03 Thread Basile B. via Digitalmars-d-learn
On Saturday, 3 June 2017 at 20:02:13 UTC, Mark wrote: On Saturday, 3 June 2017 at 19:57:47 UTC, Mark wrote: Hello again. I'm designing a template version of a BST. Because of this, I want to be able to compare if two objects of the same class type are references to the same anonymous class

Re: string to wchar*?

2017-06-03 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 3 June 2017 at 23:36:18 UTC, Mike B Johnson wrote: https://dlang.org/phobos/std_utf.html#toUTF16z This didn't work. More errors than the first. Works for me: void main() { import std.conv; import std.stdio; import core.stdc.wchar_; import core.stdc.stdio;

Re: RAII pointers

2017-06-03 Thread ag0aep6g via Digitalmars-d-learn
On 06/03/2017 09:37 PM, Moritz Maxeiner wrote: Of course, but AFAIK you'd need to explicitly assign it to an object, so `ptr` won't null by accident, but only by explicit programmer intent (same as overwriting the memory the object lives in via things like `memcpy`); and you can always screw

Re: RAII pointers

2017-06-03 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 3 June 2017 at 19:55:30 UTC, ag0aep6g wrote: On 06/03/2017 09:37 PM, Moritz Maxeiner wrote: Of course, but AFAIK you'd need to explicitly assign it to an object, so `ptr` won't null by accident, but only by explicit programmer intent (same as overwriting the memory the object

Re: How to Compare 2 objects of the same class

2017-06-03 Thread ag0aep6g via Digitalmars-d-learn
On 06/03/2017 10:02 PM, Mark wrote: auto A = new Box(); auto B = new Box(); if(A.opEquals(B)) {} gives the error test.o:(.data.rel.ro+0x18): undefined reference to `_D5Stack12__ModuleInfoZ' collect2: error: ld returned 1 exit status Error: linker exited with status 1 Your code works for

Re: How to Compare 2 objects of the same class

2017-06-03 Thread cym13 via Digitalmars-d-learn
On Saturday, 3 June 2017 at 20:02:13 UTC, Mark wrote: On Saturday, 3 June 2017 at 19:57:47 UTC, Mark wrote: Hello again. I'm designing a template version of a BST. Because of this, I want to be able to compare if two objects of the same class type are references to the same anonymous class

Re: RAII pointers

2017-06-03 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 3 June 2017 at 21:39:54 UTC, Moritz Maxeiner wrote: On Saturday, 3 June 2017 at 21:16:08 UTC, Stanislav Blinov wrote: On Saturday, 3 June 2017 at 20:53:05 UTC, Moritz Maxeiner wrote: Quite, but if you backtrack to my initial statement, it was about ptr not being/becoming null

Re: string to wchar*?

2017-06-03 Thread Ali Çehreli via Digitalmars-d-learn
On 06/03/2017 04:36 PM, Mike B Johnson wrote: On Saturday, 3 June 2017 at 23:09:56 UTC, Stanislav Blinov wrote: On Saturday, 3 June 2017 at 22:54:22 UTC, Mike B Johnson wrote: How to convert a string to wchar*? C-style null-terminated wchar*? https://dlang.org/phobos/std_utf.html#toUTF16z

Re: RAII pointers

2017-06-03 Thread Moritz Maxeiner via Digitalmars-d-learn
On Saturday, 3 June 2017 at 17:40:32 UTC, Russel Winder wrote: Would one be considered more idiomatic D, or is it a question of different circumstances different approaches. The differences are mainly in construction I believe. Well, the differences I spot are: - null check in destructor:

Re: How to Compare 2 objects of the same class

2017-06-03 Thread Mark via Digitalmars-d-learn
On Saturday, 3 June 2017 at 19:57:47 UTC, Mark wrote: Hello again. I'm designing a template version of a BST. Because of this, I want to be able to compare if two objects of the same class type are references to the same anonymous class on the heap somewhere. Example: Not sure what

Re: Guide - Migrating from std.experimental.ndslice to mir-algorithm

2017-06-03 Thread Zz via Digitalmars-d-learn
On Saturday, 3 June 2017 at 05:21:13 UTC, 9il wrote: On Friday, 2 June 2017 at 16:08:20 UTC, Zz wrote: Hi, Just tried migrating from std.experimental.ndslice to mir-algorithm. Is there a guide on how migrate old code? I used the following imports before and using then with ndslice.

string to wchar*?

2017-06-03 Thread Mike B Johnson via Digitalmars-d-learn
How to convert a string to wchar*? string s; to!(wchar*)(s) gives phobo's deduction problems. \dmd2\windows\bin\..\..\src\phobos\std\conv.d(194): Error: template std.conv.toImpl cannot deduce function from argument types !(wchar*)(string), candidates are:

Re: How to Compare 2 objects of the same class

2017-06-03 Thread Mark via Digitalmars-d-learn
On Saturday, 3 June 2017 at 22:52:42 UTC, Mark wrote: Thanks again. Nevermind, I got it.

Re: string to wchar*?

2017-06-03 Thread Mike B Johnson via Digitalmars-d-learn
On Saturday, 3 June 2017 at 23:09:56 UTC, Stanislav Blinov wrote: On Saturday, 3 June 2017 at 22:54:22 UTC, Mike B Johnson wrote: How to convert a string to wchar*? C-style null-terminated wchar*? https://dlang.org/phobos/std_utf.html#toUTF16z This didn't work. More errors than the first.

Re: RAII pointers

2017-06-03 Thread Moritz Maxeiner via Digitalmars-d-learn
On Saturday, 3 June 2017 at 19:21:58 UTC, ag0aep6g wrote: On 06/03/2017 09:06 PM, Moritz Maxeiner wrote: - null check in destructor: That's just because I forgot to add it. If you add `@disable(this)` (disable the default constructor), all elaborate constructors ensure it is not null, and no

Re: RAII pointers

2017-06-03 Thread Moritz Maxeiner via Digitalmars-d-learn
On Saturday, 3 June 2017 at 20:25:22 UTC, Stanislav Blinov wrote: On Saturday, 3 June 2017 at 20:13:30 UTC, Moritz Maxeiner wrote: Calling std.algorithm.move is explicit programmer intent, I consider that about as accidental as calling memcpy with a source full of zeroes. In any case, having

Re: RAII pointers

2017-06-03 Thread Moritz Maxeiner via Digitalmars-d-learn
On Saturday, 3 June 2017 at 21:16:08 UTC, Stanislav Blinov wrote: On Saturday, 3 June 2017 at 20:53:05 UTC, Moritz Maxeiner wrote: Quite, but if you backtrack to my initial statement, it was about ptr not being/becoming null (implicitly) in the first place, which *might* allow you to skip

Re: string to wchar*?

2017-06-03 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 3 June 2017 at 22:54:22 UTC, Mike B Johnson wrote: How to convert a string to wchar*? C-style null-terminated wchar*? https://dlang.org/phobos/std_utf.html#toUTF16z

Re: How to Compare 2 objects of the same class

2017-06-03 Thread Mark via Digitalmars-d-learn
On Saturday, 3 June 2017 at 23:32:44 UTC, Ali Çehreli wrote: ... Ali Awesome, that might be handy in the near future. Thanks.

Re: RAII pointers

2017-06-03 Thread ag0aep6g via Digitalmars-d-learn
On 06/03/2017 09:06 PM, Moritz Maxeiner wrote: - null check in destructor: That's just because I forgot to add it. If you add `@disable(this)` (disable the default constructor), all elaborate constructors ensure it is not null, and no members can set it to null, you might be able to skip the

How to Compare 2 objects of the same class

2017-06-03 Thread Mark via Digitalmars-d-learn
Hello again. I'm designing a template version of a BST. Because of this, I want to be able to compare if two objects of the same class type are references to the same anonymous class on the heap somewhere. Example:

Re: RAII pointers

2017-06-03 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 3 June 2017 at 20:53:05 UTC, Moritz Maxeiner wrote: On Saturday, 3 June 2017 at 20:25:22 UTC, Stanislav Blinov wrote: On Saturday, 3 June 2017 at 20:13:30 UTC, Moritz Maxeiner wrote: Calling std.algorithm.move is explicit programmer intent, I consider that about as accidental as

Re: How to Compare 2 objects of the same class

2017-06-03 Thread Mark via Digitalmars-d-learn
On Saturday, 3 June 2017 at 22:38:31 UTC, Mark wrote: ... Thanks. Actually, I got another question, how Can I obtain the actual memory address of a class? I'll still need to solve the problem of taking ints/floats/reals etc., as well as structs and classes and sending them right/left in

Re: How to Compare 2 objects of the same class

2017-06-03 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 3 June 2017 at 22:38:31 UTC, Mark wrote: In the future I'll include a compilable example. I was having problems with a class I made which is about 45 lines, that might be a lot of code for a post. You can use external resources such as: https://d.godbolt.org/

Re: How to Compare 2 objects of the same class

2017-06-03 Thread Ali Çehreli via Digitalmars-d-learn
On 06/03/2017 03:38 PM, Mark wrote: > Ok. So by using '==' it should compare the addresses of the objects? That's the default behavior. You can change it with opEquals: http://ddili.org/ders/d.en/object.html#ix_object.opEquals I think you want to use the 'is' operator:

Re: string to wchar*?

2017-06-03 Thread H. S. Teoh via Digitalmars-d-learn
On Sun, Jun 04, 2017 at 12:45:23AM +, Stanislav Blinov via Digitalmars-d-learn wrote: [...] > No, it shouldn't. char* et al. are not string types in D. > to!(char*)(string) just doesn't make sense. If you need to convert between D strings and char*, wchar*, etc., e.g., for interfacing with

Re: How to Compare 2 objects of the same class

2017-06-03 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Jun 03, 2017 at 10:38:31PM +, Mark via Digitalmars-d-learn wrote: [...] > Ok. So by using '==' it should compare the addresses of the objects? [...] No, `==` is for comparing the *contents* of the objects. You need to implement opEquals() for the objects being compared in order to

Re: RAII pointers

2017-06-03 Thread Moritz Maxeiner via Digitalmars-d-learn
On Saturday, 3 June 2017 at 19:55:30 UTC, ag0aep6g wrote: On 06/03/2017 09:37 PM, Moritz Maxeiner wrote: Of course, but AFAIK you'd need to explicitly assign it to an object, so `ptr` won't null by accident, but only by explicit programmer intent (same as overwriting the memory the object

Re: RAII pointers

2017-06-03 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 3 June 2017 at 20:13:30 UTC, Moritz Maxeiner wrote: Calling std.algorithm.move is explicit programmer intent, I consider that about as accidental as calling memcpy with a source full of zeroes. In any case, having that check in the destructor is fairly cheap, so better safe than

OT: RAII pointers

2017-06-03 Thread Moritz Maxeiner via Digitalmars-d-learn
On Saturday, 3 June 2017 at 21:46:45 UTC, Stanislav Blinov wrote: On Saturday, 3 June 2017 at 21:39:54 UTC, Moritz Maxeiner wrote: It's always true, because I explicitly wrote *might*, not *will*, to indicate that it depends on your use case. Your example is a common use case where you can't

Re: How to Compare 2 objects of the same class

2017-06-03 Thread Mark via Digitalmars-d-learn
On Saturday, 3 June 2017 at 20:24:44 UTC, ag0aep6g wrote: By default, they act the same. But you can change how `==` behaves by overriding `opEquals`. You cannot override `is`. Ok. So by using '==' it should compare the addresses of the objects? I think I didn't include the other file as