A few thoughts on std.allocator
Jacob Carlborg via Digitalmars-d
digitalmars-d at puremagic.com
Mon May 11 11:00:24 PDT 2015
On 2015-05-11 17:45, Andrei Alexandrescu wrote:
> For now, here's a snapshot of flags that the allocation primitives
> should know about:
>
> enum AllocOptions
> {
> /// Allocate an array, not an individual object
> array,
> /// Allocate a string of characters
> string,
> /// Plan to let the GC take care of this object
> noFree,
I would recommend using a positive name, in this case, "garbageCollected".
> /// This object will be shared between threads
> forSharing,
> /// This object will be moved between threads
> forThreadTransfer,
> /// This object will be mutable after initialization
> mutableTarget,
> /// The caller is a pure function, so result may be immutable
> fromPureFunction,
> /// Object allocated has pointers
> hasPointers,
> /// Typical (default) options
> typical = array | noFree | forSharing | mutableTarget | hasPointers
Shouldn't this be the first enum member, then this will be the default
value.
> }
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list