Re: How to convert "string" to const(wchar)* ?

2020-01-28 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Wednesday, 29 January 2020 at 06:53:15 UTC, Jonathan M Davis wrote: On Tuesday, January 28, 2020 10:17:03 PM MST Marcone via Digitalmars-d-learn wrote: [...] Of course it is. string is immutable(char)[], and the characters are in UTF-8. immutable(wchar)[] would would be UTF-16. Even

Re: How to convert "string" to const(wchar)* ?

2020-01-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, January 28, 2020 10:17:03 PM MST Marcone via Digitalmars-d-learn wrote: > How to convert "string" to const(wchar)* ? > The code bellow is making confuse strange characters. > > cast(wchar*) str Of course it is. string is immutable(char)[], and the characters are in UTF-8.

Re: How to convert "string" to const(wchar)* ?

2020-01-28 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Wednesday, 29 January 2020 at 05:17:03 UTC, Marcone wrote: How to convert "string" to const(wchar)* ? The code bellow is making confuse strange characters. cast(wchar*) str this seems working: string s = "test ğüişçöıı"; wstring wstr = s.to!wstring; const(wchar)* str = wstr.ptr;

How to convert "string" to const(wchar)* ?

2020-01-28 Thread Marcone via Digitalmars-d-learn
How to convert "string" to const(wchar)* ? The code bellow is making confuse strange characters. cast(wchar*) str

Re: Question about alias and getOverloads

2020-01-28 Thread uranuz via Digitalmars-d-learn
I have read it two or three times just before writing my question: https://dlang.org/spec/declaration.html#alias And also a have read all the dlang docs several time few years ago... ;) But I don't see what do you you mean by writing that it was menioned here. I don't se any words or any

Re: Question about alias and getOverloads

2020-01-28 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 28 January 2020 at 19:59:15 UTC, uranuz wrote: So as far as I understand alias template parameter gives access to all of items of overload set as I was expecting. The only problem is that I didn't found something about it in specification about templates:

Re: Looking for a Simple Doubly Linked List Implementation

2020-01-28 Thread Barry allen via Digitalmars-d-learn
your linked list seems very complex

Re: Question about alias and getOverloads

2020-01-28 Thread uranuz via Digitalmars-d-learn
Thanks for advice ;) This looks like some `standard trick` that is yet not learnt or forgoten by me personally. The key was in using `parent` trait. This is what I failed to think of. This is working as expected: //- import std; import core.thread; import std.meta: AliasSeq; void

Re: Question about alias and getOverloads

2020-01-28 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 28 January 2020 at 19:26:03 UTC, uranuz wrote: Hello! I have a question about `alias` template parameter and getOverloads. For instance I have some code like this: // - import std; import core.thread; void foo(string param1) {} void foo(string param1, int param2) {} template

Question about alias and getOverloads

2020-01-28 Thread uranuz via Digitalmars-d-learn
Hello! I have a question about `alias` template parameter and getOverloads. For instance I have some code like this: // - import std; import core.thread; void foo(string param1) {} void foo(string param1, int param2) {} template Bar(alias Func) { // Next line is not valid now. This is

Re: iopipe: Writing output to std.io File

2020-01-28 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/28/20 1:25 AM, Jesse Phillips wrote: I really feel like this is all very well thought out and clean, I don't appear to have a previous model to help visualize this output approach. Right now something like tee is coming to mind. Thank you for explaining with the answer. Thanks! Tee is

Blog Post #0100: SFX - Button Interactions II

2020-01-28 Thread Ron Tarrant via Digitalmars-d-learn
Today marks the 100th post on the GtkDcoding blog where we continue with Button interactions. You can find it here: https://gtkdcoding.com/2020/01/28/0100-sfx-button-interactions-ii-color-font-shape.html After today, I'll be on hiatus from the blog and posts may be sporadic.

Re: Subrange type

2020-01-28 Thread Ali Çehreli via Digitalmars-d-learn
On 1/28/20 1:55 AM, Herbert wrote: > wow, pragma, pragma was to indicate the type of elements at compile time. > import ... Yes, iota is a Phobos feature, part of a module. > only to declare a subrange type, something so simple and natural Some languages think so. > I could use it in many

Re: Subrange type

2020-01-28 Thread Herbert via Digitalmars-d-learn
On Monday, 27 January 2020 at 22:05:57 UTC, Ali Çehreli wrote: On 1/27/20 1:15 PM, Herbert wrote: On Monday, 27 January 2020 at 20:15:33 UTC, Steven Schveighoffer wrote: On 1/27/20 3:06 PM, Herbert wrote: [...] D doesn't have a "Range" type like this. But you can use ranges of different

Re: Custom separator in array format

2020-01-28 Thread Malte via Digitalmars-d-learn
On Tuesday, 28 January 2020 at 08:54:16 UTC, Simen Kjærås wrote: import std.stdio : writefln; import std.format : format; import std.algorithm : map; auto vec = [1000, 2000, 3000]; writefln("%-(%s\t%)", vec.map!(e => format!"%,2?d"('_', e))); That helps, thank you very

Re: Custom separator in array format

2020-01-28 Thread Simen Kjærås via Digitalmars-d-learn
On Tuesday, 28 January 2020 at 07:36:25 UTC, Malte wrote: I want to format an array using the %(...%) syntax. How can I change the separator? I tried to use ? and add it as additional parameter, but that doesn't seem to work on arrays: import std; void main() { writeln("This works:");