Re: Write UTF-8 bytes directly to stack buffer

2022-03-13 Thread Brian Callahan via Digitalmars-d-learn
On Sunday, 13 March 2022 at 07:55:01 UTC, Chris Piker wrote: Hey thanks! That does work with recent versions of dmd+phobos, but doesn't work in gdc-10. For some reason it produces this error: ```d error: static assert "Cannot put a const(char)[] into a char[]." ``` Is there a work arou

Re: Detecting manifest contants

2022-03-13 Thread Basile B. via Digitalmars-d-learn
On Saturday, 12 March 2022 at 18:49:32 UTC, Anonymouse wrote: I'm introspecting structs, and I ran into an issue where `__traits(derivedMembers)` includes manifest constant enums in the returned tuple. What is the correct way to statically detect these? The immediate thing that springs to mi

Re: Write UTF-8 bytes directly to stack buffer

2022-03-13 Thread Chris Piker via Digitalmars-d-learn
On Thursday, 10 March 2022 at 17:59:33 UTC, H. S. Teoh wrote: Probably what you're looking for is std.format.formattedWrite. For example: ```d import std; void main() { ubyte[65536] buf; char[] usable_buf = cast(char[]) buf[]; usable_buf.formattedWrite!"Blah %d blah %s"(123, "Э