Steve, thank you once again. Now it compiles & runs!
I now create my tree like this:
auto debs = new RedBlackTree!(Deb, (a, b) => a.name < b.name);
(I feel that the rbtree docs are inadequate regarding creating
new empty trees, so have submitted a bug report:
On 3/7/20 8:22 AM, mark wrote:
0x55701ef0 in
_D3std9container6rbtree__T12RedBlackTreeTAyaVQea5_61203c2062Vbi0ZQBn5emptyMFNaNbNdNiNfZb
(this=0x0)
at
/home/mark/opt/ldc2-1.20.0-linux-x86_64/bin/../import/std/container/rbtree.d:967
967 return _end.left is null;
(gdb) bt
07.03.2020 15:58, Steven Schveighoffer пишет:
Hm... I'd say:
1. Don't use a pointer for the element. Just use the struct directly.
Using a pointer is bad because it's now going to compare pointers, and
not the element data. Not only that, but RBNodes are stored as
heap-allocated structs, so
I've now gone back to using structs direct without pointers but
I'm still doing something wrong.
struct Deb {
string name;
...
RedBlackTree!string tags;
bool valid() { return !(name.empty || description.empty); }
void clear() { name = ""; ...; tags.clear; }
}
On 3/7/20 5:58 AM, mark wrote:
change #1:
if (line.empty) {
if (deb != null && deb.valid)
debs.insert(deb);
else // report incomplete
deb = null;
continue;
07.03.2020 13:58, mark пишет:
change #1:
if (line.empty) {
if (deb != null && deb.valid)
debs.insert(deb);
else // report incomplete
deb = null;
continue;
change #1:
if (line.empty) {
if (deb != null && deb.valid)
debs.insert(deb);
else // report incomplete
deb = null;
continue;
}
if (deb == null)
Instead of deb.clear I'm now doing deb = null;
On Saturday, 7 March 2020 at 10:30:06 UTC, drug wrote:
07.03.2020 13:20, mark пишет:
I have this struct (with details omitted
[ snip ]
Should Deb be a class rather than a struct?
Do you consider using pointers in AA:
```
Deb*[string] debForName;
```
I've done some changes including using
07.03.2020 13:20, mark пишет:
I have this struct (with details omitted
[ snip ]
Should Deb be a class rather than a struct?
Do you consider using pointers in AA:
```
Deb*[string] debForName;
```
I have this struct (with details omitted ... for brevity):
struct Deb {
string name;
...
RedBlackTree!string tags;
void clear() { name = ""; ...; tags.clear; }
bool valid() { return !(name.empty || description.empty); }
}
I plan to store >65K of these (with potential for
On Fri, 26 Jun 2015 11:11:15 +
Chris via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
I have still some classes lying around in my code. As threading
is becoming more and more of an issue, classes and OOP in general
turn out to be a nuisance. It's not so hard to turn the
On Fri, 26 Jun 2015 11:11:15 +
Chris via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
I have still some classes lying around in my code. As threading
is becoming more and more of an issue, classes and OOP in general
turn out to be a nuisance. It's not so hard to turn the
I have still some classes lying around in my code. As threading
is becoming more and more of an issue, classes and OOP in general
turn out to be a nuisance. It's not so hard to turn the classes
into structs, a lot of classes are in fact singletons (yes, I've
been kinda fading out classes for a
On Friday, 26 June 2015 at 11:28:38 UTC, Daniel Kozák wrote:
On Fri, 26 Jun 2015 11:11:15 +
Chris via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
I have still some classes lying around in my code. As
threading is becoming more and more of an issue, classes and
OOP in
On Monday, 14 May 2012 at 18:00:42 UTC, Roman D. Boiko wrote:
On Monday, 14 May 2012 at 17:37:02 UTC, Dmitry Olshansky wrote:
But hopefully you get the idea. See something simillar in
std.regex, though pointer in there also serves for intrusive
linked-list.
Thanks, most likely I'll go your
On Tuesday, 15 May 2012 at 06:17:31 UTC, Era Scarecrow wrote:
On Monday, 14 May 2012 at 18:00:42 UTC, Roman D. Boiko wrote:
On Monday, 14 May 2012 at 17:37:02 UTC, Dmitry Olshansky wrote:
But hopefully you get the idea. See something simillar in
std.regex, though pointer in there also serves
On Tuesday, 15 May 2012 at 06:17:31 UTC, Era Scarecrow wrote:
If you don't mind doing some lite informational reading, read
up on 'lex and yacc'. ISBN: 1-56592-000-7; Hope I got that
right. I'm not telling you to use C (or the other tools mind
you), but it does go into handling tokens of
On 05/14/12 17:10, Roman D. Boiko wrote:
(Subj.) I'm in doubt which to choose for my case, but this is a generic
question.
http://forum.dlang.org/post/odcrgqxoldrktdtar...@forum.dlang.org
Cross-posting here. I would appreciate any feedback. (Whether to reply in
this or that thread is up
(Subj.) I'm in doubt which to choose for my case, but this is a
generic question.
http://forum.dlang.org/post/odcrgqxoldrktdtar...@forum.dlang.org
Cross-posting here. I would appreciate any feedback. (Whether to
reply in this or that thread is up to you.) Thanks
On Monday, 14 May 2012 at 15:10:25 UTC, Roman D. Boiko wrote:
(Subj.) I'm in doubt which to choose for my case, but this is a
generic question.
http://forum.dlang.org/post/odcrgqxoldrktdtar...@forum.dlang.org
Cross-posting here. I would appreciate any feedback. (Whether
to reply in this or
Quoting your post in another thread:
On Monday, 14 May 2012 at 15:10:25 UTC, Roman D. Boiko wrote:
Making it a class would give several benefits:
* allow not to worry about allocating a big array of tokens.
E.g., on 64-bit OS the largest module in Phobos (IIRC, the
std.datetime) consumes
On Monday, 14 May 2012 at 15:44:54 UTC, Tobias Pankrath wrote:
On Monday, 14 May 2012 at 15:10:25 UTC, Roman D. Boiko wrote:
(Subj.) I'm in doubt which to choose for my case, but this is
a generic question.
http://forum.dlang.org/post/odcrgqxoldrktdtar...@forum.dlang.org
Cross-posting here.
On Monday, May 14, 2012 17:10:23 Roman D. Boiko wrote:
(Subj.) I'm in doubt which to choose for my case, but this is a
generic question.
http://forum.dlang.org/post/odcrgqxoldrktdtar...@forum.dlang.org
Cross-posting here. I would appreciate any feedback. (Whether to
reply in this or that
On Monday, 14 May 2012 at 15:53:34 UTC, Tobias Pankrath wrote:
Quoting your post in another thread:
On Monday, 14 May 2012 at 15:10:25 UTC, Roman D. Boiko wrote:
Making it a class would give several benefits:
* allow not to worry about allocating a big array of tokens.
E.g., on 64-bit OS
On 14.05.2012 19:10, Roman D. Boiko wrote:
(Subj.) I'm in doubt which to choose for my case, but this is a generic
question.
http://forum.dlang.org/post/odcrgqxoldrktdtar...@forum.dlang.org
Cross-posting here. I would appreciate any feedback. (Whether to reply
in this or that thread is up to
struct Token{
uint col, line;
uint flags;//indicated info about token, serves as both
type tag and flag set;
//indicates proper type once token was cooked (like 31.415926
- 3.145926e1) i.e. values are calculated
union {
string chars;
float f_val;
On Monday, 14 May 2012 at 16:41:39 UTC, Jonathan M Davis wrote:
On Monday, May 14, 2012 17:10:23 Roman D. Boiko wrote:
(Subj.) I'm in doubt which to choose for my case, but this is a
generic question.
http://forum.dlang.org/post/odcrgqxoldrktdtar...@forum.dlang.org
Cross-posting here. I would
On 14.05.2012 21:16, Tobias Pankrath wrote:
struct Token{
uint col, line;
uint flags;//indicated info about token, serves as both type tag and
flag set;
//indicates proper type once token was cooked (like 31.415926 -
3.145926e1) i.e. values are calculated
union {
string chars;
float f_val;
On Monday, 14 May 2012 at 17:05:17 UTC, Dmitry Olshansky wrote:
On 14.05.2012 19:10, Roman D. Boiko wrote:
(Subj.) I'm in doubt which to choose for my case, but this is
a generic
question.
http://forum.dlang.org/post/odcrgqxoldrktdtar...@forum.dlang.org
Cross-posting here. I would appreciate
On 14.05.2012 21:20, Roman D. Boiko wrote:
On Monday, 14 May 2012 at 16:41:39 UTC, Jonathan M Davis wrote:
On Monday, May 14, 2012 17:10:23 Roman D. Boiko wrote:
(Subj.) I'm in doubt which to choose for my case, but this is a
generic question.
On 14.05.2012 21:33, Dmitry Olshansky wrote:
On 14.05.2012 21:20, Roman D. Boiko wrote:
On Monday, 14 May 2012 at 16:41:39 UTC, Jonathan M Davis wrote:
On Monday, May 14, 2012 17:10:23 Roman D. Boiko wrote:
(Subj.) I'm in doubt which to choose for my case, but this is a
generic question.
On Monday, 14 May 2012 at 17:37:02 UTC, Dmitry Olshansky wrote:
But hopefully you get the idea. See something simillar in
std.regex, though pointer in there also serves for intrusive
linked-list.
Thanks, most likely I'll go your way.
On Monday, 14 May 2012 at 18:00:42 UTC, Roman D. Boiko wrote:
On Monday, 14 May 2012 at 17:37:02 UTC, Dmitry Olshansky wrote:
But hopefully you get the idea. See something simillar in
std.regex, though pointer in there also serves for intrusive
linked-list.
Thanks, most likely I'll go your
Hello,
There seems to be 2 main differences between structs classes:
1. structs instances are direct values, implement value semantics; while class
instances are referenced (actually pointed)
2. classes can be subtyped/subclassed in a simple way; structs cannot be really
subtyped -- but there
On Sunday 14 November 2010 03:08:49 spir wrote:
Hello,
There seems to be 2 main differences between structs classes:
1. structs instances are direct values, implement value semantics; while
class instances are referenced (actually pointed) 2. classes can be
subtyped/subclassed in a
spir:
a value makes no sense by itself, it is bound to what it describes an aspect
of; referencing a value is meaningless, only copy makes no sense. For
instance, the position color of a visual form should be values.
Structs may have a meaning by themselves, all kind of member functions,
On 14/11/2010 11:08, spir wrote:
Hello,
There seems to be 2 main differences between structs classes:
1. structs instances are direct values, implement value semantics;
while class instances are referenced (actually pointed)
2. classes can be subtyped/subclassed in a simple way; structs
On Sun, 14 Nov 2010 03:32:18 -0800
Jonathan M Davis jmdavisp...@gmx.com wrote:
On Sunday 14 November 2010 03:08:49 spir wrote:
Hello,
There seems to be 2 main differences between structs classes:
1. structs instances are direct values, implement value semantics; while
class
On Sun, 14 Nov 2010 12:02:35 +
div0 d...@sourceforge.net wrote:
Both of these points may conflict with semantic considerations above:
we may want to use structs for fast creation, but if ever they mean
things, we must think at referencing them manually and/or using
ref parameters.
On Sunday 14 November 2010 04:14:29 spir wrote:
On Sun, 14 Nov 2010 03:32:18 -0800
Jonathan M Davis jmdavisp...@gmx.com wrote:
On Sunday 14 November 2010 03:08:49 spir wrote:
Hello,
There seems to be 2 main differences between structs classes:
1. structs instances are
spir wrote:
On Sun, 14 Nov 2010 12:02:35 +
div0 d...@sourceforge.net wrote:
Both of these points may conflict with semantic considerations above:
we may want to use structs for fast creation, but if ever they mean
things, we must think at referencing them manually and/or using
42 matches
Mail list logo