On 9/29/14, 11:44 AM, Shammah Chancellor wrote:
I don't like the idea of having to pass in template parameters
everywhere -- even for allocators. Is there some way we could have
"allocator contexts"?
E.G.
with( auto allocator = ReferencedCounted() )
{
auto foo = setExtension("hello", "txt");
}
ReferenceCounted() could replace a thread-local "new" delegate with
something it has, and when it goes out of scope, it would reset it to
whatever it was before. This would create some runtime overhead -- but
I'm not sure how much more than already exists.
I'm not sure whether we can do this within D's type system. -- Andrei