Old code no longer working on any DMD compilers

2019-09-05 Thread Jamie via Digitalmars-d-learn
I just picked up some of my old code that was working when I last used it (approximately 6 months ago) but now is no longer working. I thought it was due to using an updated compiler, so I have installed many old compilers in and attempt to make it work, but no luck. Using DVM I have tried 2.07

Re: Old code no longer working on any DMD compilers

2019-09-05 Thread Jamie via Digitalmars-d-learn
On Friday, 6 September 2019 at 00:41:12 UTC, Jonathan M Davis wrote: On Thursday, September 5, 2019 6:24:07 PM MDT Jamie via Digitalmars-d-learn wrote: /home/jamie/.dvm/compilers/dmd-2.077.0/linux/bin/../../src/phobos/std/math .d(3702): Error: fmodl cannot be interpreted at compile time

Filling an associated array of associated arrays

2020-01-14 Thread Jamie via Digitalmars-d-learn
I'm trying to initialise an associated array of associated arrays with values, taking the same approach I would for an associated array: string[string][string] table = [ "info" : [ "equation" : "H2 + I2 <=> 2HI", "type" : "elementary", ], "frc" : [ "A" :

Re: Filling an associated array of associated arrays

2020-01-14 Thread Jamie via Digitalmars-d-learn
On Tuesday, 14 January 2020 at 23:59:59 UTC, mipri wrote: On Tuesday, 14 January 2020 at 23:23:51 UTC, Jamie wrote: c.f. https://issues.dlang.org/show_bug.cgi?id=17607 I found that by searching the forums for your error. That has fixed my issue. I had searched the forums for relevant topics,

Passing pointer to extern(C++) templated function

2020-10-13 Thread Jamie via Digitalmars-d-learn
I'm having difficulties linking templated functions with multiple pointer arguments with extern(C++). a.cpp - template void func1(T *b){} template void func1(int *b); template void func2(const T *a){} template void func2(const int *a); template void func3(T *b, const T *a){} template void

Re: Passing pointer to extern(C++) templated function

2020-10-13 Thread Jamie via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 23:47:24 UTC, kinke wrote: On Tuesday, 13 October 2020 at 09:23:48 UTC, Jamie wrote: It appears that func3 and func4 take on different types depending on other variables being present? Is this expected? Nope, it's a bug in the Itanium C++ mangler, please file a b

Re: Passing pointer to extern(C++) templated function

2020-10-13 Thread Jamie via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 23:39:38 UTC, Ali Çehreli wrote: On 10/13/20 4:11 PM, James Blachly wrote: On 10/13/20 5:23 AM, Jamie wrote: I think the issue is with D's "turtles all the way down" style const. My workaround would be to define wrapper functions that may need to do casting on

Install of nightly with install.sh is not latest version

2021-04-27 Thread Jamie via Digitalmars-d-learn
When using the install.sh script and choosing 'dmd-nightly' I'm currently getting DMD v2.091.0-beta.2-master-ec39fe5 (the folder downloaded is dmd-master-2020-03-10). I can install a more recent version using install 'dmd' etc. Is this a bug? Or am I just using it incorrectly? Cheers

Re: Install of nightly with install.sh is not latest version

2021-04-27 Thread Jamie via Digitalmars-d-learn
On Tuesday, 27 April 2021 at 12:35:52 UTC, Jamie wrote: When using the install.sh script and choosing 'dmd-nightly' I'm currently getting DMD v2.091.0-beta.2-master-ec39fe5 (the folder downloaded is dmd-master-2020-03-10). I can install a more recent version using install 'dmd' etc. Is this a

Error calling geqrs function from lubeck package.

2018-04-16 Thread Jamie via Digitalmars-d-learn
I'm attempting to use the lubeck package, as described here https://forum.dlang.org/post/axacgiisczwvygyef...@forum.dlang.org I have lubeck, mir-algorithm, mir-blas, mir-lapack downloaded and accessible by the compiler, and I have installed liblapack-dev and libblas-dev. When I attempt to ru

Re: Error calling geqrs function from lubeck package.

2018-04-16 Thread Jamie via Digitalmars-d-learn
On Tuesday, 17 April 2018 at 03:26:25 UTC, Jamie wrote: Sorry it's really an error calling geqrs function from mir-lapack package.

Inherit from class based on bool value

2018-11-12 Thread Jamie via Digitalmars-d-learn
I would like my class to inherit from one of two classes based on a boolean value known at compile time. Something like this: void main() { Top!(OPTION.FALSE) top = new Top!(OPTION.FALSE); } enum OPTION { FALSE = 0., TRUE = 1. } class One {} class Two {} class Top(OPTION option)

Re: Inherit from class based on bool value

2018-11-13 Thread Jamie via Digitalmars-d-learn
On Tuesday, 13 November 2018 at 07:29:30 UTC, Ali Çehreli wrote: On 11/12/2018 11:10 PM, Jamie wrote: > I would like my class to inherit from one of two classes ... > Is this possible? I can't get it to work in the way I'm showing above. > Cheers I got it working inside an eponymous template. D

Simultaneously assigning to all values in a tuple

2019-03-27 Thread Jamie via Digitalmars-d-learn
Is it possible to assign to all values in a tuple at once if they are the same type? I.e. Tuple!(double, "x", double, "y") t; t[] = 1.0;

Are static variables available to other static variables?

2019-04-12 Thread Jamie via Digitalmars-d-learn
I was trying to declare a static variable dependent on another static variable, but it didn't work. Are static variables not known to other static variables at compile time? void main() { C c = new C(); } class C { static size_t A = 2; static size_t B = 2^^A; // A is not

Re: Are static variables available to other static variables?

2019-04-12 Thread Jamie via Digitalmars-d-learn
On Friday, 12 April 2019 at 10:49:19 UTC, Jamie wrote: I was trying to declare a static variable dependent on another static variable, but it didn't work. Are static variables not known to other static variables at compile time? void main() { C c = new C(); } class C { stat

Do @property attributes not allow postincrement operators

2019-04-13 Thread Jamie via Digitalmars-d-learn
Do @property attributes not allow postincrement operators? import std.stdio; struct Foo { @property bar() { return 10; } @property bar(int x) { writeln(x); } } void main() { Foo foo; writeln(foo.bar); // actually calls foo.bar(); foo.bar = 10; // calls foo.bar(10); // f

Re: Do @property attributes not allow postincrement operators

2019-04-13 Thread Jamie via Digitalmars-d-learn
On Sunday, 14 April 2019 at 02:11:52 UTC, Mike Franklin wrote: On Sunday, 14 April 2019 at 01:54:39 UTC, Jamie wrote: Do @property attributes not allow postincrement operators? ... It's a long standing issue (going on 7 years old) ... I plan on getting to it, but there are other pressing thing

Re: How to delete element from array container or dlist?

2019-04-25 Thread Jamie via Digitalmars-d-learn
On Sunday, 18 March 2018 at 16:14:06 UTC, Michael wrote: On Sunday, 18 March 2018 at 15:42:18 UTC, Andrey Kabylin wrote: On Sunday, 18 March 2018 at 15:32:47 UTC, Michael wrote: On Sunday, 18 March 2018 at 14:58:52 UTC, Andrey Kabylin wrote: In DList we have method remove, but I can't understan

Alias function with arguments

2019-07-10 Thread Jamie via Digitalmars-d-learn
Is it possible to alias a function and its arguments, but for that function to only be evaluated when the alias is used? For example alias pragma(inline, true) inline inline void func(){}

Re: Using file as input to stdin when compiling

2018-02-05 Thread Jamie via Digitalmars-d-learn
On Tuesday, 6 February 2018 at 06:10:30 UTC, Jamie wrote: Hi, I'm following through TDPL and am trying to import a txt file during compiling for the stdin.byLine() function to read. Currently I have #!/usr/bin/rdmd and would like it to analyse the supplied text file. Is this possible in the w

Using file as input to stdin when compiling

2018-02-05 Thread Jamie via Digitalmars-d-learn
Hi, I'm following through TDPL and am trying to import a txt file during compiling for the stdin.byLine() function to read. Currently I have #!/usr/bin/rdmd and would like it to analyse the supplied text file. Is this possible in the way that I'm thinking, or is there another way? Thanks

Assigning to slice of array

2018-03-01 Thread Jamie via Digitalmars-d-learn
I'm trying to understand arrays and have read a lot of the information about them on this forum. I think I understand that they are set-up like Type[], so that int[][] actually means an array of int[]. I create an array as per the following: auto arr = new int[3][2][1]; which produces:

Re: Assigning to slice of array

2018-03-01 Thread Jamie via Digitalmars-d-learn
On Thursday, 1 March 2018 at 21:31:49 UTC, Steven Schveighoffer wrote: No, I think you did int[3][2], if you got that output. Otherwise it would have been: [[[0,0,0],[0,0,0]]] Yes apologies that was there from a previous attempt, you are correct. Well, that's because that type of slicing i

Re: Assigning to slice of array

2018-03-01 Thread Jamie via Digitalmars-d-learn
On Thursday, 1 March 2018 at 21:34:41 UTC, Jonathan M Davis wrote: Don't put the indices within the brackets. What you want is auto arr = new int[][][](3, 2, 1); Okay thanks, but I don't understand what is the issue with having static arrays there instead? My functionality didn't change when

Re: Assigning to slice of array

2018-03-01 Thread Jamie via Digitalmars-d-learn
On Thursday, 1 March 2018 at 23:17:11 UTC, Jonathan M Davis wrote: So, something like auto arr = new int[][][](3, 2, 1); arr.length = 4; arr[0].length = 5; arr[0][0].length = 6; is legal, but something like Thanks Jonathan, this is exactly what I was looking for. I was getting confused with

Passing directory as compiler argument not finding file

2018-04-11 Thread Jamie via Digitalmars-d-learn
With a directory structure as follows: run/ A/ a.d Where a.d is: === module A.d; I'm attempting to compile from the run/ directory. If I run with dmd ../A/a.d it compiles successfully, however if I pass it the directory dmd -I=../A a.d it doesn't compi

Re: Passing directory as compiler argument not finding file

2018-04-12 Thread Jamie via Digitalmars-d-learn
On Thursday, 12 April 2018 at 06:30:25 UTC, Tony wrote: On Thursday, 12 April 2018 at 05:39:21 UTC, Jamie wrote: Am I using the -I compiler option incorrectly? I believe so. I think it is for finding import files, not the files you are compiling. ---