Re: Sanity check: pithiest test for static if: "is an array of ubyte"

2025-05-24 Thread Andy Valencia via Digitalmars-d-learn
On Sunday, 25 May 2025 at 01:06:12 UTC, Steven Schveighoffer wrote: static if(isArray!(typeof(arg))) && is(typeof(arg[0]) == ubyte)) ``` Note that even if arg.length is 0, this is fine, because the expression isn't actually executed. Hope this helps you to understand the issue. Actually, I

Re: Sanity check: pithiest test for static if: "is an array of ubyte"

2025-05-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On Saturday, 24 May 2025 at 20:29:52 UTC, Andy Valencia wrote: The best I"ve come up with for a "static if" to see if something's an array of ubyte: ```d (isArray!(typeof(arg))) && is(typeof(arg).init[0] == ubyte) ``` Which doesn't seem to work, but it's the closest I've come by poring over t

Re: Sanity check: pithiest test for static if: "is an array of ubyte"

2025-05-24 Thread Andy Valencia via Digitalmars-d-learn
On Saturday, 24 May 2025 at 21:58:16 UTC, H. S. Teoh wrote: static if (is(typeof(myArray) == ubyte[])) { ... } Oh! I knew I was missing something. Thank you to both of you for pointing at this. Andy

Re: Sanity check: pithiest test for static if: "is an array of ubyte"

2025-05-24 Thread Nick Treleaven via Digitalmars-d-learn
On Saturday, 24 May 2025 at 20:29:52 UTC, Andy Valencia wrote: The best I"ve come up with for a "static if" to see if something's an array of ubyte: OK, so e.g. `ubyte[] arg`. ```d (isArray!(typeof(arg))) && ``` That's fine. is(typeof(arg).init[0] == ubyte) 1. Unfortunately `typeof(arg)

Re: Sanity check: pithiest test for static if: "is an array of ubyte"

2025-05-24 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, May 24, 2025 at 08:29:52PM +, Andy Valencia via Digitalmars-d-learn wrote: > The best I"ve come up with for a "static if" to see if something's an > array of ubyte: > > ```d > (isArray!(typeof(arg))) && is(typeof(arg).init[0] == ubyte) > ``` That's totally overkill. Just do this:

Re: Sanity check: pithiest test for static if: "is an array of ubyte"

2025-05-24 Thread just say no to phobos brainrot via Digitalmars-d-learn
On Saturday, 24 May 2025 at 20:29:52 UTC, Andy Valencia wrote: The best I"ve come up with for a "static if" to see if something's an array of ubyte: is(typeof(arg) == ubyte[])

Sanity check: pithiest test for static if: "is an array of ubyte"

2025-05-24 Thread Andy Valencia via Digitalmars-d-learn
The best I"ve come up with for a "static if" to see if something's an array of ubyte: ```d (isArray!(typeof(arg))) && is(typeof(arg).init[0] == ubyte) ``` Which doesn't seem to work, but it's the closest I've come by poring over the docs and reading Phobos source. TIA! Andy

Re: Pragma msg goes out of memory when supplied with large data.

2025-05-24 Thread realhet via Digitalmars-d-learn
On Friday, 23 May 2025 at 13:10:47 UTC, Dennis wrote: I recommend keeping it simple, cover common cases and don't try to make it perfect, because it won't be. But if you do somehow make it perfect, post your results, I'd love to see it! When you look at it through my glasses (graphical IDE), I

Re: Pragma msg goes out of memory when supplied with large data.

2025-05-24 Thread realhet via Digitalmars-d-learn
On Friday, 23 May 2025 at 22:11:58 UTC, Ali Çehreli wrote: On 5/23/25 6:10 AM, Dennis wrote: > This results in a complex system that's more annoying to deal with than > the original problem of just maintaining a .d file and shader file in > parallel, which is what I'm doing now for the time bein