Re: Replacing tango.text.Ascii.isearch

2022-10-09 Thread rassoc via Digitalmars-d-learn
On 10/9/22 03:08, Siarhei Siamashka via Digitalmars-d-learn wrote: Does the difference really have to be two orders of magnitude for you to acknowledge that there might be a performance problem in Phobos? [...] Except that similar one-liners implemented using other programming languages are fa

Re: Explicit cast to @system?

2022-10-09 Thread tsbockman via Digitalmars-d-learn
On Saturday, 8 October 2022 at 23:06:13 UTC, Anonymouse wrote: I have some nested templated code that takes function pointers. In many cases I pass it functions of identical signatures, except some are `@safe` and others are `@system`. In those cases the templates end up getting instantiated tw

Re: Explicit cast to @system?

2022-10-09 Thread user1234 via Digitalmars-d-learn
On Saturday, 8 October 2022 at 23:06:13 UTC, Anonymouse wrote: I have some nested templated code that takes function pointers. In many cases I pass it functions of identical signatures, except some are `@safe` and others are `@system`. In those cases the templates end up getting instantiated tw

Re: Explicit cast to @system?

2022-10-09 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 9 October 2022 at 16:25:22 UTC, tsbockman wrote: You might be templating more information than necessary. In your example `foo` doesn't need to be a template at all: ```D void foo(void function() @system fun) { pragma(msg, typeof(fun).stringof); } ``` Yes, it was a toy example.

Re: Explicit cast to @system?

2022-10-09 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 9 October 2022 at 17:42:57 UTC, user1234 wrote: But surely there has to be a better way? No. Darn. Okay, thanks.

Re: Passing D reimplementation of C++ template as argument to a C++ function

2022-10-09 Thread Gregor Mückl via Digitalmars-d-learn
On Sunday, 25 September 2022 at 23:23:51 UTC, Nicholas Wilson wrote: On Saturday, 24 September 2022 at 07:04:34 UTC, Gregor Mückl wrote: extern(C++) extern(C++, class) struct Foo(T) { T a, b; } alias FooFloat = Foo!float; extern(C++) void bar(FooFloat f); ``` This works when you mirror al

Example for multi level template composition

2022-10-09 Thread Arun via Digitalmars-d-learn
Stumbled upon this question on HN https://news.ycombinator.com/item?id=33142751#33147401 Can I write template A and then apply it to itself to get template B and then apply that onto template C to get template D. Does anyone have an example for this?