41 karma · joined Aug 14, 2012 (14y ago) · 14 submissions
comment 9y ago · link · parent
comment 10y ago · link · parent
comment 10y ago · link · parent
EDIT: I also don't see how destruction of a list is any harder than iteration of a list, as far as writing it tail recursively. You would need to make sure your node destructors are trivial, but you probably need to do this anyway if you intend to support using a custom Allocator (would instead have template <typename Allocator> destroy(node*, Allocator&); that calls Allocator::destroy on the contained value and Allocator::deallocate on the node). The implementation would then look something along the lines of:
decltype(head) next; for (auto ptr = head; ptr; ptr = next) { next = ptr->next; if (ptr->unique()) { destroy(ptr, allocator); } }
(unique() is a method on node - intrusive ref count.)
comment 11y ago · link · parent
http://research.microsoft.com/pubs/64044/compilingwithcontin...
comment 12y ago · link · parent
13.
Javascript, Underscore, and type class emulation(reddit.com ↗)
1 points · by sonyandy · 14y ago · discuss
comment 14y ago · link · parent