Re: How to get the element type of an array?

2020-08-24 Thread Jon Degenhardt via Digitalmars-d-learn
On Tuesday, 25 August 2020 at 04:36:56 UTC, H. S. Teoh wrote: [...] Harry Gillanders, H.S. Teoh, Thank you both for the quick replies. Both methods address my needs. Very much appreciated, I was having trouble figuring this one out. --Jon

Re: How to get the element type of an array?

2020-08-24 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 25 August 2020 at 03:41:06 UTC, Jon Degenhardt wrote: What's the best way to get the element type of an array at compile time? Something like std.range.ElementType except that works on any array type. There is std.traits.ForeachType, but it wasn't clear if that was the right

Re: what's this Error: corrupt MS Coff object module

2020-08-24 Thread mw via Digitalmars-d-learn
On Tuesday, 25 August 2020 at 01:44:16 UTC, mw wrote: I just tried, using -m32: /mnt/c/project/dlang/dmd-2.093.1/windows/bin/sc.ini [Environment] DFLAGS="-I%@P%\..\..\src\phobos" "-I%@P%\..\..\src\druntime\import" "-d" "-m32" at least that error is gone, and I was able to build:

opIndex for type list

2020-08-24 Thread data pulverizer via Digitalmars-d-learn
Hi all, I am trying to implement `opIndex` (e.g. T[i]) for types in a struct. So for I have `length`: ```d struct TList(T...) { enum long length = T.length; } ``` and have tried including ```d alias opIndex(long i) = T[i]; ``` or ```d alias opIndex(alias i) = T[i]; ``` called with

Re: opIndex for type list

2020-08-24 Thread data pulverizer via Digitalmars-d-learn
On Monday, 24 August 2020 at 14:19:14 UTC, data pulverizer wrote: I am trying to implement `opIndex` (e.g. T[i]) for types in a struct. p.s. I know I could just write a separate `get` template, but `AliasSeq` has opIndex and opSlice operators, so I wonder whether it is possible to get those

Re: opIndex for type list

2020-08-24 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 24 August 2020 at 14:19:14 UTC, data pulverizer wrote: I am trying to implement `opIndex` (e.g. T[i]) for types in a struct. So for I have `length`: Can't really do that, the operator overloads work on instances instead of static types. AliasSeq is magical because it just gives a

Re: opIndex for type list

2020-08-24 Thread James Lu via Digitalmars-d-learn
On Monday, 24 August 2020 at 14:19:14 UTC, data pulverizer wrote: Hi all, I am trying to implement `opIndex` (e.g. T[i]) for types in a struct. So for I have `length`: ```d struct TList(T...) { enum long length = T.length; } ``` and have tried including ```d alias opIndex(long i) = T[i];

Re: opIndex for type list

2020-08-24 Thread data pulverizer via Digitalmars-d-learn
On Monday, 24 August 2020 at 14:36:22 UTC, Adam D. Ruppe wrote: On Monday, 24 August 2020 at 14:19:14 UTC, data pulverizer wrote: I am trying to implement `opIndex` (e.g. T[i]) for types in a struct. So for I have `length`: Can't really do that, the operator overloads work on instances

Re: how to run 'dub upgrade' from within VisualD?

2020-08-24 Thread mw via Digitalmars-d-learn
On Monday, 24 August 2020 at 21:19:14 UTC, mw wrote: Hi, Just wonder how to run 'dub upgrade' from within VisualD? on Windows of course. In "Solution Explorer", I right click "asdf" and select "DUB Upgrade", but nothing happened: $ grep asdf ats.sln

Re: Introspecting a package for submodules

2020-08-24 Thread Anonymouse via Digitalmars-d-learn
On Monday, 24 August 2020 at 22:32:52 UTC, Anonymouse wrote: `__traits(allMembers, std.algorithm)` evaluates to nothing, but replace it with `std.algorithm.searching` and it does. `std.algorithm` makes for a bad example as it is actually empty save for imports. Just read it as `std.datetime`

Introspecting a package for submodules

2020-08-24 Thread Anonymouse via Digitalmars-d-learn
I have some modules, and then one `package.d` file that publicly imports them all. I have reason to access them individually however, with hopes of being able to enumerate them and introspect with `__traits(allMembers, someModule)`. Concretely, I want to express "find all module-level classes

How to get the element type of an array?

2020-08-24 Thread Jon Degenhardt via Digitalmars-d-learn
What's the best way to get the element type of an array at compile time? Something like std.range.ElementType except that works on any array type. There is std.traits.ForeachType, but it wasn't clear if that was the right thing. --Jon

Re: How to get the element type of an array?

2020-08-24 Thread Harry Gillanders via Digitalmars-d-learn
On Tuesday, 25 August 2020 at 03:41:06 UTC, Jon Degenhardt wrote: What's the best way to get the element type of an array at compile time? Something like std.range.ElementType except that works on any array type. There is std.traits.ForeachType, but it wasn't clear if that was the right

Re: How to get the element type of an array?

2020-08-24 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Aug 25, 2020 at 03:41:06AM +, Jon Degenhardt via Digitalmars-d-learn wrote: > What's the best way to get the element type of an array at compile > time? > > Something like std.range.ElementType except that works on any array > type. There is std.traits.ForeachType, but it wasn't

Re: Master Thesis using D Programming language.

2020-08-24 Thread James Blachly via Digitalmars-d-learn
On Monday, 24 August 2020 at 19:56:49 UTC, Tariq Siddiqui wrote: Hello everyone, I am looking for a master thesis topic using D Programming language. Earlier I choose Design by Introspection, but I did not find enough material in academic journals. DbI total material which I found is DConf

Master Thesis using D Programming language.

2020-08-24 Thread Tariq Siddiqui via Digitalmars-d-learn
Hello everyone, I am looking for a master thesis topic using D Programming language. Earlier I choose Design by Introspection, but I did not find enough material in academic journals. DbI total material which I found is DConf Andrei talk and the similar talk at Google campus, which starts

how to run 'dub upgrade' from within VisualD?

2020-08-24 Thread mw via Digitalmars-d-learn
Hi, Just wonder how to run 'dub upgrade' from within VisualD? on Windows of course. thanks.

what's this Error: corrupt MS Coff object module

2020-08-24 Thread mw via Digitalmars-d-learn
I got this error, when build with VisualD-v1.0.1-dmd-2.093.1-ldc2-1.23.0.exe dmd: lib\unit-threaded_property.lib: Error: corrupt MS Coff object module

Re: what's this Error: corrupt MS Coff object module

2020-08-24 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 25 August 2020 at 00:41:27 UTC, mw wrote: How to fix this Coff object issues? there's two library formats: coff and omf. omf is the old one that dmd assumes without arguments. coff is the new one with `dmd -m32mscoff` or `dmd -m64`. I would guess one of those libs was built

Re: what's this Error: corrupt MS Coff object module

2020-08-24 Thread mw via Digitalmars-d-learn
On Tuesday, 25 August 2020 at 01:35:00 UTC, mw wrote: On Tuesday, 25 August 2020 at 01:13:11 UTC, Adam D. Ruppe wrote: On Tuesday, 25 August 2020 at 01:08:49 UTC, mw wrote: Is it safe to just delete all the: yup. I have to do this every other week on my work box to keep its hard drive from

Re: Introspecting a package for submodules

2020-08-24 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 25 August 2020 at 00:09:38 UTC, Adam D. Ruppe wrote: On Monday, 24 August 2020 at 22:32:52 UTC, Anonymouse wrote: How do I do this? (Is there some other way?) Not really a way. A package doesn't quite exist in D; there is no formal construct that is a package and has a defined

Re: Introspecting a package for submodules

2020-08-24 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 24 August 2020 at 22:32:52 UTC, Anonymouse wrote: How do I do this? (Is there some other way?) Not really a way. A package doesn't quite exist in D; there is no formal construct that is a package and has a defined list if stuff. It is just whatever modules are compiled in that

Re: what's this Error: corrupt MS Coff object module

2020-08-24 Thread mw via Digitalmars-d-learn
On Tuesday, 25 August 2020 at 00:56:51 UTC, Adam D. Ruppe wrote: Might help to just delete the old directories and let it redownload and recompile fresh with all the new settings. Is it safe to just delete all the: C:\Users...\AppData\Local\dub\packages\ and run `dub upgrade` again to

Re: what's this Error: corrupt MS Coff object module

2020-08-24 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 25 August 2020 at 01:08:49 UTC, mw wrote: Is it safe to just delete all the: yup. I have to do this every other week on my work box to keep its hard drive from filling up lol

Re: what's this Error: corrupt MS Coff object module

2020-08-24 Thread mw via Digitalmars-d-learn
On Tuesday, 25 August 2020 at 01:13:11 UTC, Adam D. Ruppe wrote: On Tuesday, 25 August 2020 at 01:08:49 UTC, mw wrote: Is it safe to just delete all the: yup. I have to do this every other week on my work box to keep its hard drive from filling up lol I just completely deleted that