digitalmars.D.announce - automem v0.3.5 - now with more vector (like std::vector, not Physics)!
- Atila Neves (23/23) Sep 20 2018 If you've never heard of automem before, I wrote it to have
- 12345swordy (3/6) Sep 20 2018 Official bindings to std::vector will soon be added by manu. (I
- ikod (18/21) Sep 30 2018 Sorry for asking here.
- Atila Neves (3/29) Oct 01 2018 This really should have been a github issue, but thanks for
If you've never heard of automem before, I wrote it to have C++-style smart pointers in D that I could use in nogc code: http://code.dlang.org/packages/automem I needed something like a std::vector that can be nogc so I wrote it. I wondered whether or not to put it in a collections package or not, then punted on the decision and just stuck it in automem. Anyway, code: // *no* GC allocations below if theAllocator is set to an allocator that // never allocates on the GC heap import automem.vector; // there's an `array` alias too auto v = vector(0, 1, 2); v ~= 3; v ~= only(4, 5); assert(v[] == [0, 1, 2, 3, 4, 5]); If you want the nogc compile-time guarantee, specify an allocator: () nogc { auto v = vector!Mallocator(0, 1, 2, 3); v ~= only(4, 5, 6); // etc. }(); Enjoy (hopefully)!
Sep 20 2018
On Thursday, 20 September 2018 at 14:57:42 UTC, Atila Neves wrote:If you've never heard of automem before, I wrote it to have C++-style smart pointers in D that I could use in nogc code: [...]Official bindings to std::vector will soon be added by manu. (I think)
Sep 20 2018
On Thursday, 20 September 2018 at 14:57:42 UTC, Atila Neves wrote:If you've never heard of automem before, I wrote it to have C++-style smart pointers in D that I could use in nogc code: http://code.dlang.org/packages/automemSorry for asking here. Shouldn't this code work? import automem; struct X { int i; } struct Y { RefCounted!X x; // fails //X x; // ok } void main() { Y y1; Y y2; y2 = y1; } https://run.dlang.io/is/k2qWhm
Sep 30 2018
On Sunday, 30 September 2018 at 19:54:07 UTC, ikod wrote:On Thursday, 20 September 2018 at 14:57:42 UTC, Atila Neves wrote:This really should have been a github issue, but thanks for posting this anyway. I just fixed it.If you've never heard of automem before, I wrote it to have C++-style smart pointers in D that I could use in nogc code: http://code.dlang.org/packages/automemSorry for asking here. Shouldn't this code work? import automem; struct X { int i; } struct Y { RefCounted!X x; // fails //X x; // ok } void main() { Y y1; Y y2; y2 = y1; } https://run.dlang.io/is/k2qWhm
Oct 01 2018