Detroit symptoms Wayne Ellington in just ignificant recruiting victory

2019-03-07 Thread Wele cvb via Digitalmars-d-learn
The Detroit Pistons received a unanticipated and ignificant recruiting victoryas a result of coming in the direction of phrases with cost-free representative Wayne Ellington, for each ESPN Adrian Wojnarowski. Ellington, a 6-foot-5 capturing defend, is a vocation 38 per cent 3-stage marksman and

Re: How can I make a nested array and flatten it at run time in D?

2019-03-07 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Mar 08, 2019 at 01:00:43AM +, Philos Kim via Digitalmars-d-learn wrote: > I want to make a nested array and flatten it at run-time like this. > > auto nestedArray = [1, 2, [3, 4], 5]; You can't write it this way because the nested array has a different type from the other elements. Y

Re: How can I make a nested array and flatten it at run time in D?

2019-03-07 Thread James Blachly via Digitalmars-d-learn
On 3/7/19 8:00 PM, Philos Kim wrote: I want to make a nested array and flatten it at run-time like this. auto nestedArray = [1, 2, [3, 4], 5]; auto flattenedArray = myFun(nestedArray); writeln(flattenedArray);   // => [1, 2, 3, 4, 5] How can I do this in D? Please help me out! There are

How can I make a nested array and flatten it at run time in D?

2019-03-07 Thread Philos Kim via Digitalmars-d-learn
I want to make a nested array and flatten it at run-time like this. auto nestedArray = [1, 2, [3, 4], 5]; auto flattenedArray = myFun(nestedArray); writeln(flattenedArray); // => [1, 2, 3, 4, 5] How can I do this in D? Please help me out!

Re: Aliasing a mixin (or alternative ways to profile a scope)

2019-03-07 Thread Johannes Loher via Digitalmars-d-learn
Am 07.03.19 um 22:50 schrieb Johannes Loher: > [...] As a small addition, if you always want to pass the function name as a parameter, you can simplify this to the following: ``` enum profile_scope(string name = __FUNCTION__) = "import core.stdc.stdio : printf; printf(\"" ~ name ~ "\n\"); sco

Re: Aliasing a mixin (or alternative ways to profile a scope)

2019-03-07 Thread Johannes Loher via Digitalmars-d-learn
Am 07.03.19 um 22:21 schrieb Simon: > > Is there a way to achieve this while compiling with -betterC? I use a > custom string struct right now, and your version needs TypeInfo, > concatening using ~ needs the garbage collector. I have the feeling D is > really not agreeing with the way I want to d

Re: Aliasing a mixin (or alternative ways to profile a scope)

2019-03-07 Thread Simon via Digitalmars-d-learn
On Thursday, 7 March 2019 at 20:34:48 UTC, Johannes Loher wrote: auto profile_scope(string name) { import std.format : format; return q{import std.stdio : writeln; writeln("%1$s"); scope(exit) writeln("%1$s");}.format(name); } void main() { mixin(profile_scope("func1")); } Is th

Re: Aliasing a mixin (or alternative ways to profile a scope)

2019-03-07 Thread Johannes Loher via Digitalmars-d-learn
Am 07.03.19 um 21:07 schrieb Simon: > Hello, > > I am currently porting the frontend of my instrumenting profiler to D. > It features a C++-makro that profiles the time between entering and > leaving a scope (achieved with con-/destructors in C++). Since D has > scopeguards, I hoped to achieve thi

Re: Aliasing a mixin (or alternative ways to profile a scope)

2019-03-07 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 7 March 2019 at 20:07:27 UTC, Simon wrote: measure("func1"); scope(exit) measure("func1"); I would suggest just using a struct. Make its constructor do the first measure, and its destructor do the second measure. I betcha you can avoid mixin entirely.

Re: 2 class issues

2019-03-07 Thread ag0aep6g via Digitalmars-d-learn
On 07.03.19 11:38, spir wrote: -1- How to enforce that subclasses implement given methods without using "abstract", which seems to make the whole class abstract? Not, as far as I can tell. You can't force derived classes to override an existing implementation. And you can't omit the implementa

Re: 2 class issues

2019-03-07 Thread Johannes Loher via Digitalmars-d-learn
Am 07.03.19 um 11:38 schrieb spir: > Hello, > > First, I am not very experimented with the combination of static lang > (alloc & typing) and OO (class-based). I'm implementing a library for > lexical analysis (lexing), with 2 minor issues: > > -1- How to enforce that subclasses implement given me

Aliasing a mixin (or alternative ways to profile a scope)

2019-03-07 Thread Simon via Digitalmars-d-learn
Hello, I am currently porting the frontend of my instrumenting profiler to D. It features a C++-makro that profiles the time between entering and leaving a scope (achieved with con-/destructors in C++). Since D has scopeguards, I hoped to achieve this by creating a mixin that generates the fo

Re: 2 class issues -- PS

2019-03-07 Thread spir via Digitalmars-d-learn
from [https://dlang.org/spec/attribute.html#abstract] : --- abstract Attribute An abstract member function must be overridden by a derived class. Only virtual member functions may be declared abstract; non-virtual member functions and free-standing functions cannot be declared abstract

2 class issues

2019-03-07 Thread spir via Digitalmars-d-learn
Hello, First, I am not very experimented with the combination of static lang (alloc & typing) and OO (class-based). I'm implementing a library for lexical analysis (lexing), with 2 minor issues: -1- How to enforce that subclasses implement given methods without using "abstract", which seems