Re: DUB and lib curl (-lcurl)

2018-01-08 Thread rikki cattermole via Digitalmars-d-learn
On 09/01/2018 5:42 AM, Tony wrote: I am on Ubuntu 16.04. I was looking at Getting Started with DUB: http://code.dlang.org/getting_started I did the "dub init myproject" and it worked fine. Then I added dependency: ' dependency "dub" version="~>1.3.0" ' as shown in the next step. This got an er

DUB and lib curl (-lcurl)

2018-01-08 Thread Tony via Digitalmars-d-learn
I am on Ubuntu 16.04. I was looking at Getting Started with DUB: http://code.dlang.org/getting_started I did the "dub init myproject" and it worked fine. Then I added dependency: ' dependency "dub" version="~>1.3.0" ' as shown in the next step. This got an error: -

Re: Templates for DRY code

2018-01-08 Thread Mark via Digitalmars-d-learn
On Saturday, 6 January 2018 at 23:32:42 UTC, Paul Backus wrote: On Saturday, 6 January 2018 at 03:38:35 UTC, codephantom wrote: or even.. a.append( s.to!ConvertToElementType(a) ); That's not valid code of course, but the semantics are all contained in that single chunk. This works: import

Re: __traits(isSame, TemplateOf ...) errors and some Idiomatic D questions

2018-01-08 Thread aliak via Digitalmars-d-learn
On Monday, 8 January 2018 at 23:03:46 UTC, H. S. Teoh wrote: On Mon, Jan 08, 2018 at 10:59:44PM +, aliak via Digitalmars-d-learn wrote: [...] onlineapp.d(61): Error: template std.traits.TemplateOf does not match any template declaration. And I use it like this: enum r1Sorted = __traits(isS

Re: __traits(isSame, TemplateOf ...) errors and some Idiomatic D questions

2018-01-08 Thread aliak via Digitalmars-d-learn
On Monday, 8 January 2018 at 23:22:04 UTC, Seb wrote: On Monday, 8 January 2018 at 23:14:32 UTC, Seb wrote: Your problem is that `TemplateOf!(int[])` isn't defined. It should probably be changed to return `void`. https://github.com/dlang/phobos/pull/6016 Damn that's some fast turnaround! And

DIP1000 & Owning Containers

2018-01-08 Thread jmh530 via Digitalmars-d-learn
DIP1000 has a section on owning containers where it shows that you can have a reference to a member of a struct that will not outlive the struct itself. This seems to work through the function opAssign being scope ref. Why wouldn't you normally be allowed to make a scoped pointer to a member

Re: Rvalue references

2018-01-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, January 08, 2018 23:07:52 Jiyan via Digitalmars-d-learn wrote: > Sry i know i asked it already in IRC: > Are rvalue references already solved with auto ref? > > https://p0nce.github.io/d-idioms/#Rvalue-references:-Understanding-auto-re > f-and-then-not-using-it > > Says rvalues are moved

Re: __traits(isSame, TemplateOf ...) errors and some Idiomatic D questions

2018-01-08 Thread Seb via Digitalmars-d-learn
On Monday, 8 January 2018 at 23:14:32 UTC, Seb wrote: Your problem is that `TemplateOf!(int[])` isn't defined. It should probably be changed to return `void`. https://github.com/dlang/phobos/pull/6016

Re: __traits(isSame, TemplateOf ...) errors and some Idiomatic D questions

2018-01-08 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Jan 08, 2018 at 10:59:44PM +, aliak via Digitalmars-d-learn wrote: [...] > onlineapp.d(61): Error: template std.traits.TemplateOf does not match > any template declaration. And I use it like this: > > enum r1Sorted = __traits(isSame, TemplateOf!(R1), SortedRange); This seems unnecessa

Re: __traits(isSame, TemplateOf ...) errors and some Idiomatic D questions

2018-01-08 Thread Seb via Digitalmars-d-learn
On Monday, 8 January 2018 at 22:59:44 UTC, aliak wrote: Hi, trying to write some idiomatic generic D code and I'm a bit stuck with using the TemplateOf to check if a range is a SortedRange or not. A bit about the code, I'm basically rewriting https://dlang.org/library/std/algorithm/setops/set_

Rvalue references

2018-01-08 Thread Jiyan via Digitalmars-d-learn
Sry i know i asked it already in IRC: Are rvalue references already solved with auto ref? https://p0nce.github.io/d-idioms/#Rvalue-references:-Understanding-auto-ref-and-then-not-using-it Says rvalues are moved! The other solution seems not so practical. Is any solution to them intended, or w

__traits(isSame, TemplateOf ...) errors and some Idiomatic D questions

2018-01-08 Thread aliak via Digitalmars-d-learn
Hi, trying to write some idiomatic generic D code and I'm a bit stuck with using the TemplateOf to check if a range is a SortedRange or not. A bit about the code, I'm basically rewriting https://dlang.org/library/std/algorithm/setops/set_difference.html but I want to do different things based on

Re: Is old style compile-time foreach redundant?

2018-01-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, January 08, 2018 06:27:12 H. S. Teoh via Digitalmars-d-learn wrote: > On Sun, Jan 07, 2018 at 10:39:19PM -0500, Steven Schveighoffer via Digitalmars-d-learn wrote: > > On 1/6/18 6:25 PM, Ali Çehreli wrote: > > > Is 'static foreach' sufficient for all needs or is there any value > > > f

Re: Is old style compile-time foreach redundant?

2018-01-08 Thread H. S. Teoh via Digitalmars-d-learn
On Sun, Jan 07, 2018 at 10:39:19PM -0500, Steven Schveighoffer via Digitalmars-d-learn wrote: > On 1/6/18 6:25 PM, Ali Çehreli wrote: > > Is 'static foreach' sufficient for all needs or is there any value > > for regular foreach over compile-time sequences? > > If you use continues or breaks, the

Re: Error: variable i cannot be read at compile time

2018-01-08 Thread Vino via Digitalmars-d-learn
On Monday, 8 January 2018 at 08:22:21 UTC, thedeemon wrote: On Monday, 8 January 2018 at 07:37:31 UTC, Vino wrote: I tried to manipulate the writeln's as below but the output is not as expected as it prints the data in row wise, where as we need it in column wise. Ah, sorry, now I think I ge

Re: Error: variable i cannot be read at compile time

2018-01-08 Thread thedeemon via Digitalmars-d-learn
On Monday, 8 January 2018 at 07:37:31 UTC, Vino wrote: I tried to manipulate the writeln's as below but the output is not as expected as it prints the data in row wise, where as we need it in column wise. Ah, sorry, now I think I get it. Your problem is you get output like ["a","b","c"] and i

Re: Error: variable i cannot be read at compile time

2018-01-08 Thread thedeemon via Digitalmars-d-learn
On Monday, 8 January 2018 at 07:37:31 UTC, Vino wrote: I tried to manipulate the writeln's as below but the output is not as expected as it prints the data in row wise, where as we need it in column wise. ... Using the function countUntil find the keys for each of the column and store the res