Zig vs D generics
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Mon Oct 10 10:23:44 UTC 2022
On Monday, 10 October 2022 at 09:55:32 UTC, Ola Fosheim Grøstad
wrote:
> On Monday, 10 October 2022 at 07:30:38 UTC, Kagamin wrote:
>> Eh? So can C++ support an allocator that works both at compile
>> time and at run time? I use such allocator in my D code so
>> it's ctfeable.
>
> No, only encapsulated types can hold memory. This is the right
> approach when you don't have garbage collection. If you allow
> manual compile time allocation you end up with something that
> doesn't scale in terms of debugging.
>
> Or you need a very advanced debugger.
Argh, I couldn't make this work either in C++20. I thought
std::string("hello world) should be constexpr returnable.
Apparently not, unless I did something wrong. (That is a big
weakness, so I really hope I did something wrong. ;-)
More information about the Digitalmars-d
mailing list