Customization of DUB build=DDOX output

2014-12-16 Thread Vadim Lopatin via Digitalmars-d-learn
Hello, I'm trying to use DDOX to generate documentation pages for my library (dlangui). dub --build=ddox produces nice output with navigation by modules, but I cannot find out how to embed some custom navigation pane on all pages. E.g. put links to some additional pages like downloads,

Re: mixin template and const property qualifier?

2014-12-16 Thread aldanor via Digitalmars-d-learn
On Monday, 15 December 2014 at 23:21:05 UTC, anonymous wrote: On Monday, 15 December 2014 at 23:14:30 UTC, aldanor wrote: Could someone please explain why the following doesn't compile with const qualifier while it does work without it? /* test.d */ module test; mixin template Foo() {

Re: Odd Error Message

2014-12-16 Thread CraigDillabaugh via Digitalmars-d-learn
On Monday, 15 December 2014 at 22:20:53 UTC, ketmar via Digitalmars-d-learn wrote: On Mon, 15 Dec 2014 22:09:28 + CraigDillabaugh via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Given the following program: import std.string; import std.stdio; void main() {

Re: UDA and mixins

2014-12-16 Thread Oleg via Digitalmars-d-learn
struct FooPasted(Args...){} class A { mixin foo; void func1() @mark { ... } void func2( int x, string a ) @mark { ... } } must change to: class A { void func1() @mark { ... } void func2( int x, string a ) @mark { ... } FooPasted!() func1_mark; FooPasted!(int,string) func2_mark; }

Re: Asssociative Array by Key-Value-Pair

2014-12-16 Thread Tobias Pankrath via Digitalmars-d-learn
so it will be documented? that was the rhetorical question. Does it need to be? I don't see a reason for anyone to go out of their way to make the implementation inconsistent. Do you? At least I would prefer not to rely on undefined behaviour. If we ever do change the AA implementation

Re: Asssociative Array by Key-Value-Pair

2014-12-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/16/14 10:33 AM, Tobias Pankrath wrote: so it will be documented? that was the rhetorical question. Does it need to be? I don't see a reason for anyone to go out of their way to make the implementation inconsistent. Do you? At least I would prefer not to rely on undefined behaviour.

Re: Asssociative Array by Key-Value-Pair

2014-12-16 Thread Nordlöw
On Monday, 15 December 2014 at 23:21:44 UTC, bearophile wrote: Nordlöw: BTW: Why doesn't aa.byKey.map work? It currently works. Bye, bearophile My mistake. Now both are at https://github.com/nordlow/justd/blob/master/range_ex.d#L527

Re: Asssociative Array by Key-Value-Pair

2014-12-16 Thread Nordlöw
On Tuesday, 16 December 2014 at 16:08:09 UTC, Steven Schveighoffer wrote: I can never ever see a reason to implement 2 different ways to traverse the elements, just to piss off people? If you make a PR that adds that to documentation, I will pull it if it makes you feel better. I don't think

Re: Asssociative Array by Key-Value-Pair

2014-12-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/16/14 11:47 AM, Nordlöw wrote: On Tuesday, 16 December 2014 at 16:08:09 UTC, Steven Schveighoffer wrote: I can never ever see a reason to implement 2 different ways to traverse the elements, just to piss off people? If you make a PR that adds that to documentation, I will pull it if it

Re: Asssociative Array by Key-Value-Pair

2014-12-16 Thread Nordlöw
On Tuesday, 16 December 2014 at 16:56:20 UTC, Steven Schveighoffer wrote: I can do PR for adding https://github.com/nordlow/justd/blob/master/range_ex.d#L527 to Phobos. Were should I put it/them? I think to be clear, the PR I said I will pull is for the documentation update. A doc change

Re: Asssociative Array by Key-Value-Pair

2014-12-16 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Dec 16, 2014 at 11:56:20AM -0500, Steven Schveighoffer via Digitalmars-d-learn wrote: On 12/16/14 11:47 AM, Nordlöw wrote: On Tuesday, 16 December 2014 at 16:08:09 UTC, Steven Schveighoffer wrote: I can never ever see a reason to implement 2 different ways to traverse the elements,

Re: detaching a thread from druntime 2.067

2014-12-16 Thread Sean Kelly via Digitalmars-d-learn
On Tuesday, 16 December 2014 at 04:56:10 UTC, Ellery Newcomer wrote: If I have a thread that I need to detach from druntime, I can call thread_detachInstance, but for 2.066, this function does not exist. Is there any way to do this in 2.066? I notice there is a thread_detachByAddr, but I'm not

Re: Asssociative Array by Key-Value-Pair

2014-12-16 Thread Nordlöw
On Tuesday, 16 December 2014 at 17:47:18 UTC, H. S. Teoh via Digitalmars-d-learn wrote: also rename byPair to something else in the process). What about by Python's byItem() and items()?

Referring to alias parameters in a mixin template

2014-12-16 Thread aldanor via Digitalmars-d-learn
Would something like this be possible at all? A hypothetical mixin template mixin template makeProperty(T, string name, alias func) { ... } that could be called like this: makeProperty!(int, foo, f) and would generate code like int @property foo() { return f(); }

Re: detaching a thread from druntime 2.067

2014-12-16 Thread Ellery Newcomer via Digitalmars-d-learn
On 12/16/2014 10:41 AM, Sean Kelly wrote: On Tuesday, 16 December 2014 at 04:56:10 UTC, Ellery Newcomer wrote: If I have a thread that I need to detach from druntime, I can call thread_detachInstance, but for 2.066, this function does not exist. Is there any way to do this in 2.066? I notice

Re: Referring to alias parameters in a mixin template

2014-12-16 Thread aldanor via Digitalmars-d-learn
A partial solution would be something like this: mixin template makeProperty(T, string name, alias func) { enum p = makeUnnamedProperty!(T, func); mixin(enum %s = p;.format(name)); // or alias } however now the parent namespace is polluted with p, is there any way to

Re: Referring to alias parameters in a mixin template

2014-12-16 Thread anonymous via Digitalmars-d-learn
On Wednesday, 17 December 2014 at 01:14:36 UTC, aldanor wrote: A partial solution would be something like this: mixin template makeProperty(T, string name, alias func) { enum p = makeUnnamedProperty!(T, func); mixin(enum %s = p;.format(name)); // or alias } however now

Binding non-trivial C++ structs

2014-12-16 Thread Paul O'Neil via Digitalmars-d-learn
To make my C++ binding life easier, I wrote a small string structure [1] in C++ to use instead of std::string and produced the D declarations for some of it [2]. (It's not that complicated, I promise.) The important properties of this struct are that it has a non-trivial copy constructor and a

Re: Referring to alias parameters in a mixin template

2014-12-16 Thread aldanor via Digitalmars-d-learn
On Wednesday, 17 December 2014 at 01:39:07 UTC, anonymous wrote: But if you want to avoid `p`, just do the substitution: mixin template makeProperty(T, string name, alias func) { mixin(enum %s = makeUnnamedProperty!(T, func);.format(name)); // or alias } Thanks, that looks

Re: Referring to alias parameters in a mixin template

2014-12-16 Thread anonymous via Digitalmars-d-learn
On Wednesday, 17 December 2014 at 01:49:14 UTC, aldanor wrote: Wonder if this is doable within a single mixin template without using makeUnnamedProperty? Sure, straight forward: mixin template makeProperty(T, string name, alias func) { mixin(T %s() @property { return func();

Re: Referring to alias parameters in a mixin template

2014-12-16 Thread aldanor via Digitalmars-d-learn
On Wednesday, 17 December 2014 at 02:12:52 UTC, anonymous wrote: Sure, straight forward: mixin template makeProperty(T, string name, alias func) { mixin(T %s() @property { return func(); }.format(name)); } Indeed... thanks! Just one thing that I find confusing here --

eraseInPlace (eg using memmove)?

2014-12-16 Thread Timothee Cour via Digitalmars-d-learn
Is there a phobos way to do eraseInPlace (eg with optimization using memmove where appropriate) ? (akin to insertInPlace)

Re: eraseInPlace (eg using memmove)?

2014-12-16 Thread Timothee Cour via Digitalmars-d-learn
Here's what I'd like in phobos: void eraseInPlace(T)(ref T a, size_t index, size_t n=1) if(isArray!T){ enum s=typeof(a[0]).sizeof; auto ptr=a.ptr+index; import core.stdc.string:memmove; memmove(ptr,ptr+n,(a.length-(index+n))*s); a.length-=n; } unittest{ auto a=[0,1,2,3,4,5,6];