dcollections 1.0 and 2.0a beta released

Steven Schveighoffer schveiguy at yahoo.com
Fri May 21 09:16:57 PDT 2010


superdan Wrote:

> == Quote from Steven Schveighoffer (schveiguy at yahoo.com)'s article

> > Is there some other reason to use structs besides copy construction?
> > -Steve
> 
> memory management n shit. with a struct u can use refcounting n malloc n realloc n
> shit. still stays a reference type. nothing gets fucked up.

This is not necessary with purely memory-based constructs -- the GC is your friend.  The custom allocator ability in dcollections should provide plenty of freedom for memory allocation schemes.

> 
> den there's all that null ref shit. with a class u have
> 
> void foo(container!shit poo)
> {
>     poo.addElement(Shit(diarrhea));
> }
> 
> dat works with struct but don't work with motherfucking classes. u need to write.
> 
> void foo(container!shit poo)
> {
>     if (!poo) poo = new container!shit; // fuck dat shit
>     poo.addElement(Shit(diarrhea));
> }
> 
> u feel me?

It doesn't work.  Just with your example, you won't get what you expect.  Try it with AA's.

Even your class example doesn't make any sense.

-Steve


More information about the Digitalmars-d-announce mailing list