Skip to content

Commit

Permalink
Merge pull request #391 from vibe-d/std_experimental_allocator
Browse files Browse the repository at this point in the history
Make the code work for RCIAllocator
  • Loading branch information
s-ludwig authored Feb 19, 2024
2 parents 0df6402 + 1db9414 commit a4e79a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions source/vibe/internal/interfaceproxy.d
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import std.traits : BaseTypeTuple;
O asInterface(I, O)(O obj) if (is(I == interface) && is(O : I)) { return obj; }
InterfaceProxyClass!(I, O) asInterface(I, O)(O obj) if (is(I == interface) && !is(O : I)) { return new InterfaceProxyClass!(I, O)(obj); }

InterfaceProxyClass!(I, O) asInterface(I, O)(O obj, IAllocator allocator)
InterfaceProxyClass!(I, O) asInterface(I, O, Allocator)(O obj, Allocator allocator)
@trusted if (is(I == interface) && !is(O : I))
{
alias R = InterfaceProxyClass!(I, O);
return allocator.makeGCSafe!R(obj);
}

void freeInterface(I, O)(InterfaceProxyClass!(I, O) inst, IAllocator allocator)
void freeInterface(I, O, Allocator)(InterfaceProxyClass!(I, O) inst, Allocator allocator)
{
allocator.disposeGCSafe(inst);
}
Expand Down
2 changes: 1 addition & 1 deletion source/vibe/internal/string.d
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ ptrdiff_t matchBracket(string str, bool nested = true)
}

/// Same as std.string.format, just using an allocator.
string formatAlloc(ARGS...)(IAllocator alloc, string fmt, ARGS args)
string formatAlloc(Allocator, ARGS...)(Allocator alloc, string fmt, ARGS args)
{
auto app = AllocAppender!string(alloc);
formattedWrite(() @trusted { return &app; } (), fmt, args);
Expand Down

0 comments on commit a4e79a8

Please sign in to comment.