Re: how to properly compare this type?

2021-02-09 Thread frame via Digitalmars-d-learn
On Tuesday, 9 February 2021 at 23:12:57 UTC, Jack wrote: arr is empty You need to check for __traits(getOverloads,...), isCallable!, ReturnType!.

how to properly compare this type?

2021-02-09 Thread Jack via Digitalmars-d-learn
I have a class like this: struct S { } class A { @(S) { int a; string b() { return ib; } string b(string s) { return ib = s;} } int x; int y; string ib = "lol"; } where I want to list the members

Re: GC.addRange in pure function

2021-02-09 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 9 February 2021 at 20:50:12 UTC, Max Haughton wrote: On Tuesday, 9 February 2021 at 19:53:27 UTC, Temtaime wrote: On Sunday, 7 February 2021 at 14:13:18 UTC, vitamin wrote: Why using 'new' is allowed in pure functions but calling GC.addRange or GC.removeRange isn't allowed? pure

Re: GC.addRange in pure function

2021-02-09 Thread Max Haughton via Digitalmars-d-learn
On Tuesday, 9 February 2021 at 19:53:27 UTC, Temtaime wrote: On Sunday, 7 February 2021 at 14:13:18 UTC, vitamin wrote: Why using 'new' is allowed in pure functions but calling GC.addRange or GC.removeRange isn't allowed? pure is broken. Just don't [use it] [Citation needed]

Re: GC.addRange in pure function

2021-02-09 Thread Temtaime via Digitalmars-d-learn
On Sunday, 7 February 2021 at 14:13:18 UTC, vitamin wrote: Why using 'new' is allowed in pure functions but calling GC.addRange or GC.removeRange isn't allowed? pure is broken. Just don't [use it]

Real simple unresolved external symbols question...

2021-02-09 Thread WhatMeWorry via Digitalmars-d-learn
I'm trying to create a super simple dynamic library consisting of two files: file2.d -- extern(D): double addEight(double d) { return (d + 8.0); } fileB.d -- extern(D) { string concatSuffix(string s) {

Re: Profiling

2021-02-09 Thread drug via Digitalmars-d-learn
On Tuesday, 9 February 2021 at 07:45:13 UTC, JG wrote: I was trying to profile a d program. So I ran: dub build --build=profile. I then ran the program and it produced trace.log and trace.def. I then ran d-profile-viewer and got the following error:

Re: Profiling

2021-02-09 Thread Dukc via Digitalmars-d-learn
On Tuesday, 9 February 2021 at 16:39:25 UTC, Dukc wrote: You may have or may not have done it wrong, but in any case this is a bug. If you do something wrong, the program should tell you what you did wrong, instead of telling you that character '-' does not belong to middle of a long int. Oh

Re: Profiling

2021-02-09 Thread Dukc via Digitalmars-d-learn
On Tuesday, 9 February 2021 at 07:45:13 UTC, JG wrote: Is d-profile-viewer no longer working? Or did I do something wrong? You may have or may not have done it wrong, but in any case this is a bug. If you do something wrong, the program should tell you what you did wrong, instead of telling

Re: Traits of variadic templates

2021-02-09 Thread Jeff via Digitalmars-d-learn
On Tuesday, 9 February 2021 at 16:25:46 UTC, Paul Backus wrote: On Tuesday, 9 February 2021 at 16:22:16 UTC, Jeff wrote: But, those don't work because T is a Tuple of the types. Is there some trait combination I can use to do this? Something like (obviously made up)... all(TemplateArgsOf!T,

Re: Traits of variadic templates

2021-02-09 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 9 February 2021 at 16:22:16 UTC, Jeff wrote: But, those don't work because T is a Tuple of the types. Is there some trait combination I can use to do this? Something like (obviously made up)... all(TemplateArgsOf!T, t => isIntegral!t || isSomeString!t) Thanks! import std.meta:

Traits of variadic templates

2021-02-09 Thread Jeff via Digitalmars-d-learn
Let's say I have... void foo(T...)(T xs) { foreach(x; xs) { if (typeid(x) == typeid(int)) writeln("int: ", x); else writeln("str: ", x); } } From the body, it's obvious I really only want int or string to be passed in to foo. Ideally, this

Re: Are there any containers that go with allocators?

2021-02-09 Thread John Burton via Digitalmars-d-learn
On Tuesday, 9 February 2021 at 12:23:52 UTC, rikki cattermole wrote: https://github.com/dlang-community/containers It uses the older design for allocators (dependency). Looks good, thank you

Re: Are there any containers that go with allocators?

2021-02-09 Thread rikki cattermole via Digitalmars-d-learn
https://github.com/dlang-community/containers It uses the older design for allocators (dependency).

Are there any containers that go with allocators?

2021-02-09 Thread John Burton via Digitalmars-d-learn
Normally I'm happy with the GC containers in D, they work well and suit my use. I have a few uses that would benefit from allocation in memory arenas or local stack based allocation. Looks like std.experimental has allocators for those use cases. But I can't find any containers to make use