Re: Store any callable in an array

2018-05-06 Thread wjoe via Digitalmars-d-learn
Thanks for replying. On Friday, 4 May 2018 at 19:12:16 UTC, ag0aep6g wrote: On 05/04/2018 06:33 PM, Neia Neutuladh wrote: auto asDelegate(TFunc)(TFunc func) @trusted {     import std.functional : toDelegate;     return toDelegate(func); } The "@trusted" means that you promise this thing is

Re: Store any callable in an array

2018-05-06 Thread wjoe via Digitalmars-d-learn
Thanks for replying. On Saturday, 5 May 2018 at 00:30:35 UTC, Neia Neutuladh wrote: On Friday, 4 May 2018 at 19:12:16 UTC, ag0aep6g wrote: [...] If it's a user-defined type with opCall, that's something to pay attention to, but it's beyond the scope of the original question. Actually it's

Re: Purity of delegate-style toString

2018-05-06 Thread Q. Schroll via Digitalmars-d-learn
On Tuesday, 1 May 2018 at 12:03:15 UTC, ag0aep6g wrote: On 05/01/2018 01:44 PM, Per Nordlöw wrote: In which cases (if any) is it possible to make a delegate-style implementation of toString such as     void toString(scope void delegate(const(char)[]) sink) const @trusted pure     {   

Overload Resulution Template with 2 Functions vs. 2 Templates difference

2018-05-06 Thread Q. Schroll via Digitalmars-d-learn
Why is there a difference between struct S { template func(T) { enum impl = "whatever string"; auto func(T arg) { mixin(impl); } // eponymous template auto func(T arg) const { mixin(impl); } // eponymous template } } and struct R { private enum impl = "whatever

Re: C++ / const class pointer signature / unable to find correct D syntax

2018-05-06 Thread Rubn via Digitalmars-d-learn
On Friday, 4 May 2018 at 07:57:26 UTC, Uknown wrote: On Friday, 4 May 2018 at 07:49:02 UTC, Robert M. Münch wrote: I have a static C++ and can't make it to get a correct binding for one function: DMD: public: unsigned int __cdecl b2d::Context2D::_begin(class b2d::Image & __ptr64,class

Re: could someone test support for Asian languages in nanogui port?

2018-05-06 Thread drug via Digitalmars-d-learn
On 06.05.2018 06:10, Binghoo Dang wrote: hi, I'm a Chinese, and I just have done the test. I also copied some Japanese text from Dlang twitter channel and added some Chinese wide punctuation Char. And It's all seems displayed correctly. The resulting screenshot is here: