April 17, 2017
On Monday, 17 April 2017 at 13:21:50 UTC, Kagamin wrote:

> If we can control memory layout, we can do what shared_ptr does and couple the reference counter with the object, then we can have just one pointer:
>
> struct RefCounted(T)
> {
>   struct Wrapper
>   {
>     int count;
>     T payload;
>   }
>   Wrapper* payload;
> }

I'm not sure I follow your comment. Indeed, that is how shared_ptr, or, in this case, RefCounted, is implemented. My point was that there is no practical sense in having a shared(RefCounted).
April 28, 2017
On Sunday, 9 April 2017 at 15:52:50 UTC, Basile B. wrote:
> On Sunday, 9 April 2017 at 08:56:52 UTC, Atila Neves wrote:
>> Using std.experimental.allocator? Tired of writing `scope(exit) allocator.dispose(foo);` in a language with RAII? Me too:
>>
>>
>>
>> http://code.dlang.org/packages/automem
>>
>
> I think that the Array misses
> - a reservation strategy, something like reserve() and allocBy().

reserve is done. What would allocBy be?

> - dup / idup that return new distinct and deep copies.

dup is done. I'm trying to figure out how one would use .idup.

> - maybe .ptr at least for reading with pointer arithmetic.

Done.

> - opBinary for "~" . Also you have bugs with operators:

Done.
>
> ```d
> import std.experimental.allocator.mallocator;
> UniqueArray!(int, Mallocator) a;
> a ~= [0,1];
> ```
>
> crashes directly.

Fixed.

Atila


1 2 3
Next ›   Last »