Re: Using private constructor with std.experimental.allocater:make

2016-05-01 Thread earthfront via Digitalmars-d-learn
On Sunday, 1 May 2016 at 19:18:38 UTC, Basile B wrote: CT make(CT, Alloc, A...)(auto ref Alloc al, A a) This works. Thank you. Good point about __ctor alone not being sufficient. auto memory = al.allocate(size); ... GC.addRange(memory.ptr, size, typeid(CT)); Nit:

Using private constructor with std.experimental.allocater:make

2016-05-01 Thread earthfront via Digitalmars-d-learn
Hello! This code fails: - void main(){ class A { int b; private this(int a){b=a;} } //{ int b; this(int a){b=a;} } import std.conv:emplace; import std.experimental.allocator.mallocator:Mallocator; import std.experimental.allocator:make; { auto ptr =

Re: Multiple selective imports on one line

2015-12-24 Thread earthfront via Digitalmars-d-learn
On Wednesday, 23 December 2015 at 20:56:39 UTC, Basile B. wrote: This is not available in the grammar. You can still open a duplicate enhancement request. https://issues.dlang.org/show_bug.cgi?id=14704 see also: http://forum.dlang.org/post/trrxoacvpyyqrdfqx...@forum.dlang.org OK. I'm

Re: Multiple selective imports on one line

2015-12-23 Thread earthfront via Digitalmars-d-learn
On Wednesday, 23 December 2015 at 11:12:22 UTC, ZombineDev wrote: Actually array() is from sts.array and correct way to use selective imports is: import std.exception : enforce; import std.array : array; import std.algorithm.iteration : filter; import std.functional : memoize; If you want to

Re: Multiple selective imports on one line

2015-12-23 Thread earthfront via Digitalmars-d-learn
On Wednesday, 23 December 2015 at 11:00:19 UTC, Jakob Ovrum wrote: On Wednesday, 23 December 2015 at 10:51:52 UTC, earthfront wrote: Now I'm left with a smattering of lines which are just selective imports from a single module: import std.exception:enforce; import std.algorithm:array;

Multiple selective imports on one line

2015-12-23 Thread earthfront via Digitalmars-d-learn
I'm using hackerpilot's excellent textadept plugin + DCD, Dfmt, and Dscanner. Upon saving files, it produces suggestions, much like warnings from the compiler. One suggestion is to use selective imports in local scopes. OK, I'll do that. Now I'm left with a smattering of lines which are

Re: std.array oddness

2014-12-13 Thread earthfront via Digitalmars-d-learn
On Saturday, 13 December 2014 at 06:40:41 UTC, ketmar via Digitalmars-d-learn wrote: auto names = File(names.txt) .byLine!(char,char)(KeepTerminator.no, ',') .map!a.idup .array; Awesome. map!idup does the trick. I had looked at the byLine doc before posting, in

std.array oddness

2014-12-12 Thread earthfront via Digitalmars-d-learn
Hello! I was attempting project euler problem 22 and seeing something weird going on with the array function in std.array. I made the following code to demonstrate. Given names.txt: -- MARY,PATRICIA,LINDA,BARBARA,ELIZABETH -- and code: -- import