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:
https://issues.dlang.org/show_bug
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; }
}
RedBlackTree!
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 Deb
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 gr
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
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.
On Fri, 26 Jun 2015 11:11:15 +
Chris via Digitalmars-d-learn 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 classes
> into structs, a lot
On Fri, 26 Jun 2015 11:11:15 +
Chris via Digitalmars-d-learn 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 classes
> into structs, a lot
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 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
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 multi
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 fo
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 w
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 w
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 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.
http
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.
http://forum.dlang.org/post/odcrgqxoldrktdtar...@f
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: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;
d
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
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 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 yo
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 the
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
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. I
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 13.
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 th
(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
spir wrote:
> On Sun, 14 Nov 2010 12:02:35 +
> div0 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
On Sunday 14 November 2010 04:14:29 spir wrote:
> On Sun, 14 Nov 2010 03:32:18 -0800
>
> Jonathan M Davis 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 dire
On Sun, 14 Nov 2010 12:02:35 +
div0 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. We may want
On Sun, 14 Nov 2010 03:32:18 -0800
Jonathan M Davis 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 instances ar
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
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 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 i
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 the
42 matches
Mail list logo