Re: wstring double quotes to string double quotes

2018-04-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, April 19, 2018 23:24:05 Joel via Digitalmars-d-learn wrote: > On Thursday, 19 April 2018 at 21:57:28 UTC, Adam D. Ruppe wrote: > > On Thursday, 19 April 2018 at 21:53:52 UTC, Joel wrote: > >> I have a program that uses string double quotes, but copies > >> from wstring double quotes. T

Re: wstring double quotes to string double quotes

2018-04-19 Thread Joel via Digitalmars-d-learn
On Thursday, 19 April 2018 at 21:57:28 UTC, Adam D. Ruppe wrote: On Thursday, 19 April 2018 at 21:53:52 UTC, Joel wrote: I have a program that uses string double quotes, but copies from wstring double quotes. The wstring double quotes are in string type (sourceTxt is a string with wstring doubl

Re: wstring double quotes to string double quotes

2018-04-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 19 April 2018 at 21:53:52 UTC, Joel wrote: I have a program that uses string double quotes, but copies from wstring double quotes. The wstring double quotes are in string type (sourceTxt is a string with wstring double quotes). quotes are quotes, you don't need to convert to wstri

wstring double quotes to string double quotes

2018-04-19 Thread Joel via Digitalmars-d-learn
I have a program that uses string double quotes, but copies from wstring double quotes. The wstring double quotes are in string type (sourceTxt is a string with wstring double quotes). The following code crashes with an array.d(2211): Range violation error: import std.conv : to; import std.s

Re: Getting the overload set of a template

2018-04-19 Thread Simen Kjærås via Digitalmars-d-learn
On Thursday, 19 April 2018 at 13:57:04 UTC, Simen Kjærås wrote: On Tuesday, 17 April 2018 at 14:22:27 UTC, Arafel wrote: Hi! Is there any way to get the full set of templates that are "overloaded" (in my case, based on constraints)? Currently, there is no way (that I've found, at least) to d

Re: Getting the overload set of a template

2018-04-19 Thread Simen Kjærås via Digitalmars-d-learn
On Thursday, 19 April 2018 at 14:16:21 UTC, Alex wrote: On Thursday, 19 April 2018 at 13:57:04 UTC, Simen Kjærås wrote: Currently, there is no way (that I've found, at least) to do this. If you have a workaround, that's great, but there really should be a way - probably __traits(getOverloads).

Re: get literal symbol name without base class/struct as string

2018-04-19 Thread Timoses via Digitalmars-d-learn
On Tuesday, 17 April 2018 at 21:45:45 UTC, Dr.No wrote: give structs like this: struct A { int a = 10; string s = "haha"; } struct B { A aDetails; } but neither fullyQualifiedName nor stringof give the symbol in the way I need. I'd hint you towards import std.traits

Re: Getting the overload set of a template

2018-04-19 Thread Arafel via Digitalmars-d-learn
Well, if that's the lowering, then it's indeed hard. That doesn't mean it shouldn't happen, though... perhaps changing the lowering? I'm no compiles expert, so no idea how). What I'd like to get is the same that I get using __traits(getMember,...), but repeated n times (AliasSeq perhaps?), lik

getSymbolByUDA and inheritance

2018-04-19 Thread Arafel via Digitalmars-d-learn
Hi, getSymbolsByUDA doesn't work when inheritance is involved [1]: ``` import std.traits; void main() { pragma(msg, getSymbolsByUDA!(A,S).length); pragma(msg, getSymbolsByUDA!(B,S).length); } class A { @S("A") int a; } class B : A { @S("B") int b; } struct S { string name

Re: Store struct tuple of alias and access members through it?

2018-04-19 Thread Timoses via Digitalmars-d-learn
On Saturday, 7 April 2018 at 19:21:30 UTC, Simen Kjærås wrote: import std.meta; import std.traits; // List all member functions, and wrap them such that myFoo.fun(3) can be called as AllMemberFunctions!(typeof(myFoo))[idx](myFoo, 3). template AllMemberFunctions(T) { template createDg(alia

Re: Rotate array in writefln?

2018-04-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/18/18 3:15 AM, Simen Kjærås wrote: On Wednesday, 18 April 2018 at 06:54:29 UTC, Chris Katko wrote: I need to rotate an array by 90 degrees, or have writefln figure that out. I need, say: 0 4 5 6 0 0 0 0 0 0 0 0 0 0 0 0 But it's outputting: 0 0 0 0 4 0 0 0 5 0 0 0 6 0 0 0 int [4][4] da

Re: Getting the overload set of a template

2018-04-19 Thread Alex via Digitalmars-d-learn
On Thursday, 19 April 2018 at 13:57:04 UTC, Simen Kjærås wrote: Currently, there is no way (that I've found, at least) to do this. If you have a workaround, that's great, but there really should be a way - probably __traits(getOverloads). Having __traits(getOverloads) return templates as well s

Re: Getting the overload set of a template

2018-04-19 Thread Simen Kjærås via Digitalmars-d-learn
On Tuesday, 17 April 2018 at 14:22:27 UTC, Arafel wrote: Hi! Is there any way to get the full set of templates that are "overloaded" (in my case, based on constraints)? Currently, there is no way (that I've found, at least) to do this. If you have a workaround, that's great, but there really

Re: Program exited with code 1

2018-04-19 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 19 April 2018 at 11:21:52 UTC, Andrey wrote: On Thursday, 19 April 2018 at 08:37:19 UTC, Andrey wrote: What will be a solution? It seems to me that I found a solution - just replace WinMain() with main(). That's fine when you want a console app, but it leaves you with a consol

Re: making a struct an inputRange with free functions

2018-04-19 Thread jmh530 via Digitalmars-d-learn
On Thursday, 19 April 2018 at 01:33:26 UTC, Jonathan M Davis wrote: [snip] Occasionally, that aspect of importing and UFCS can be annoying, but on the whole, I don't really see why it matters much, particularly when actually having the free functions available would be an enormous change to h

Re: Program exited with code 1

2018-04-19 Thread Andrey via Digitalmars-d-learn
On Thursday, 19 April 2018 at 08:37:19 UTC, Andrey wrote: What will be a solution? It seems to me that I found a solution - just replace WinMain() with main().

Re: Rotate array in writefln?

2018-04-19 Thread Simen Kjærås via Digitalmars-d-learn
On Thursday, 19 April 2018 at 10:10:41 UTC, Chris Katko wrote: That makes sense why transpose wouldn't work for my arrays! So you're saying if I used [][] (dynamic array) that's a range of ranges, and it would work? Yup. Static arrays can't be ranges, since popFront must mutate the length, a

Re: Rotate array in writefln?

2018-04-19 Thread Chris Katko via Digitalmars-d-learn
On Wednesday, 18 April 2018 at 07:15:47 UTC, Simen Kjærås wrote: On Wednesday, 18 April 2018 at 06:54:29 UTC, Chris Katko wrote: I need to rotate an array by 90 degrees, or have writefln figure that out. I need, say: 0 4 5 6 0 0 0 0 0 0 0 0 0 0 0 0 But it's outputting: 0 0 0 0 4 0 0 0 5 0 0

Re: Program exited with code 1

2018-04-19 Thread Andrey via Digitalmars-d-learn
On Thursday, 19 April 2018 at 08:24:55 UTC, user1234 wrote: The run-time is not already initialized but the "new" operator relies on it. What will be a solution?

Re: Program exited with code 1

2018-04-19 Thread user1234 via Digitalmars-d-learn
On Thursday, 19 April 2018 at 08:13:00 UTC, Andrey wrote: Hello, I wrote a small test code with WinApi: import core.runtime; import std.utf; import core.sys.windows.windows; import core.sys.windows.wingdi; class Test { public this() noth

Program exited with code 1

2018-04-19 Thread Andrey via Digitalmars-d-learn
Hello, I wrote a small test code with WinApi: import core.runtime; import std.utf; import core.sys.windows.windows; import core.sys.windows.wingdi; class Test { public this() nothrow { } } extern(Windows) int WinMain(HINSTANCE h