Make dub ignore dependencies when building docs?

2020-05-23 Thread NaN via Digitalmars-d-learn
Can you make dub ignore dependencies when building docs?

Re: Testing template parameter has given API

2020-05-16 Thread NaN via Digitalmars-d-learn
On Saturday, 16 May 2020 at 02:02:47 UTC, Paul Backus wrote: On Saturday, 16 May 2020 at 01:11:54 UTC, NaN wrote: Rather than trying to inspect the function itself, it's easier to check that the result of *calling* the function is what you expect it to be. So, for example:

Testing template parameter has given API

2020-05-15 Thread NaN via Digitalmars-d-learn
Howdy, any idea what Im doing wrong? Given a type T i want to test the presence of certain methods. I looked in phobos to see how isInputRange was defined but it didnt really help as all the methods have no parameters and it used some weird lamda stuff i think. template isPathType(T) {

Re: Is there a way to tell if an auto ref parameter is by ref or by value?

2020-05-10 Thread NaN via Digitalmars-d-learn
On Sunday, 10 May 2020 at 01:15:58 UTC, Anonymouse wrote: On Sunday, 10 May 2020 at 00:33:07 UTC, NaN wrote: Ie something like.. auto Foo(T)(auto ref T x) { static if (isByRef(x)) { } else { } } __traits(isRef, x) Thanks :)

Is there a way to tell if an auto ref parameter is by ref or by value?

2020-05-09 Thread NaN via Digitalmars-d-learn
Ie something like.. auto Foo(T)(auto ref T x) { static if (isByRef(x)) { } else { } }

Re: ref barfs template parameter deduction?

2020-05-08 Thread NaN via Digitalmars-d-learn
On Friday, 8 May 2020 at 22:11:57 UTC, Paul Backus wrote: On Friday, 8 May 2020 at 22:03:47 UTC, NaN wrote: The integer literal `1` is an rvalue, and can't be passed by reference. If you explicitly instantiate the templates foo and bar in the function call, you get a more informative error

ref barfs template parameter deduction?

2020-05-08 Thread NaN via Digitalmars-d-learn
Ok given the following code... auto foo(T)(T x) { struct V1 { T* what; } V1 v; return v; } auto bam(T)(T x) { struct V2 { T* what; } V2 v; return v; } void bar() { bam(foo(1)); } if you change the declaration of foo or bam to "ref T x", ie.. auto foo(T)(ref T x)

Re: ref barfs template parameter deduction?

2020-05-08 Thread NaN via Digitalmars-d-learn
On Friday, 8 May 2020 at 22:03:47 UTC, NaN wrote: Ok given the following code... auto foo(T)(T x) { struct V1 { T* what; } V1 v; return v; } auto bam(T)(T x) { struct V2 { T* what; } V2 v; return v; } void bar() { bam(foo(1)); } Should have said that compiles

Cross module inline, LDC, dub dependencies.

2020-04-05 Thread NaN via Digitalmars-d-learn
OK so I am using the intel intrinsics library, I ws just copying it into my source tree. So in the interests of automation I added it as a dependency in dub, but now my code is anywhere up to 3 times slower. So I figure maybe as its being compiled as a library, it's not getting inlined because

Re: catching Errors in OS callbacks how to print stack trace?

2020-02-24 Thread NaN via Digitalmars-d-learn
On Monday, 24 February 2020 at 13:43:30 UTC, Adam D. Ruppe wrote: On Monday, 24 February 2020 at 13:42:01 UTC, NaN wrote: try { writeln(e.msg); } try `writeln(e.toString());` instead. msg only contains the message passed to the constructor by itself, toString includes the file/line

catching Errors in OS callbacks how to print stack trace?

2020-02-24 Thread NaN via Digitalmars-d-learn
Normally a failed assert gives the file, line number and a stack trace, but I hit one today that just prints.. assertion failure Im sure it is because it's in the WindowProc callback from the OS. As the callback is nothrow you need to catch and handle anything there, you have to catch all

Re: How to debug in vscode Windows?

2020-01-01 Thread NaN via Digitalmars-d-learn
On Wednesday, 1 January 2020 at 16:21:32 UTC, solidstate1991 wrote: On Wednesday, 1 January 2020 at 14:46:01 UTC, NaN wrote: Its pretty much all working, except you cant see dynamic array contents and occasionally it steps a line out of sync. I never managed to get any debugger working in

Re: How to debug in vscode Windows?

2020-01-01 Thread NaN via Digitalmars-d-learn
On Friday, 27 December 2019 at 18:48:50 UTC, cfcd14f496326e429ce03c48650b7966 wrote: Hello. I spent many time to searching for find a solutions. Many posts not clearly or tell like brief. :( I tried "Microsoft C/C++(ms-vscode.cpptools)" and "Native Debug (webfreak.debug )" plugin. And I

Re: initialize float4 (core.simd)

2019-10-06 Thread NaN via Digitalmars-d-learn
On Saturday, 21 September 2019 at 12:50:46 UTC, Bogdan wrote: I'm trying to understand how to use the `core.simd` functionality, and I'm having trouble initializing a float4 vector. Here's my example code: ``` import std.stdio; import core.simd; void main() { float[4] values = [1.0f,

Re: Performance of tables slower than built in?

2019-05-25 Thread NaN via Digitalmars-d-learn
On Saturday, 25 May 2019 at 14:58:25 UTC, Ola Fosheim Grøstad wrote: On Saturday, 25 May 2019 at 12:51:20 UTC, NaN wrote: I used an evolutionary optimisation algorithm on the table all at once. So you do a weighted sum of max deviation, and 1st and 2nd order discontinuity at the joins. And

Re: Performance of tables slower than built in?

2019-05-25 Thread NaN via Digitalmars-d-learn
On Saturday, 25 May 2019 at 09:52:22 UTC, Ola Fosheim Grøstad wrote: On Saturday, 25 May 2019 at 09:04:31 UTC, NaN wrote: Its pretty common technique in audio synthesis. Indeed. CSound does this. What i've done in the past is store a table of polynomial segments that were optimised with

Re: Performance of tables slower than built in?

2019-05-25 Thread NaN via Digitalmars-d-learn
On Friday, 24 May 2019 at 17:40:40 UTC, Ola Fosheim Grøstad wrote: On Friday, 24 May 2019 at 17:04:33 UTC, Alex wrote: I'm not sure what the real precision of the build in functions are but it shouldn't be hard to max out a double using standard methods(even if slow, but irrelevant after the

Re: Performance of tables slower than built in?

2019-05-25 Thread NaN via Digitalmars-d-learn
On Friday, 24 May 2019 at 17:04:33 UTC, Alex wrote: On Friday, 24 May 2019 at 13:57:30 UTC, Ola Fosheim Grøstad wrote: On Friday, 24 May 2019 at 12:24:02 UTC, Alex wrote: If it truly is a 27x faster then then that is very relevant and knowing why is important. Of course, a lot of that might

Re: Modulo that 'wraps' the number?

2019-01-20 Thread NaN via Digitalmars-d-learn
On Sunday, 20 January 2019 at 18:51:54 UTC, Steven Schveighoffer wrote: On 1/20/19 1:28 PM, faissaloo wrote: In Python -1%3 == 2 however in D -1%3 == -1 Is there a standard library function or something that gives me the Python version of modulo? Hm... (n%3+3)%3 should work. -Steve You