[Issue 22521] New: [CTFE] std.experimental.allocator.make and dispose are not CTFEable.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Nov 18 12:29:48 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22521
Issue ID: 22521
Summary: [CTFE] std.experimental.allocator.make and dispose are
not CTFEable.
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: ttanjo at gmail.com
Custom allocators are useful for performance (e.g., std.regex internally uses
its custom allocator)and std.experimental.allocator provides a generic
interface for them: `make` family and `dispose` family.
However, current interface of std.experimental.allocator prevents functions
that use custom allocator from CTFEability.
It would be nice if `make` family and `dispose` family can provide an interface
that enables CTFEability while keeping its flexibility.
Here is a current interface of `make`.
```dlang
auto make(T, Allocator, A...)(auto ref Allocator alloc, auto ref A args);
```
A problem is that it takes a custom allocator as a runtime parameter.
If `make` take a custom allocator as a template alias parameter, we will solve
this issue.
PoC: https://run.dlang.io/is/WYSaLd
--
More information about the Digitalmars-d-bugs
mailing list