Dynamic arrays / ~= giving an exception...

Robert M. Münch robert.muench at saphirion.com
Sun Jul 1 21:53:30 UTC 2018


On 2018-07-01 21:05:43 +0000, Cym13 said:

> On Sunday, 1 July 2018 at 20:55:16 UTC, Robert M. Münch wrote:
>> I'm a bit puzzled because I think this is pretty straight forward but 
>> doesn't work...
>> 
>> struct mystruct {
>> 	myPtr* root;
>> 
>> 	opApply(...){
>> 		myPtr*[] childs;
>> 		
>> 		childs ~= root;
>> 		...
>> 	}
>> }
>> 
>> foreach(node; mystruct(myRoot)){
>> 	...
>> }
>> 
>> It compiles but the line with ~= gives the nice "bing" under Windows 
>> and the application hangs...
>> 
>> What doesn't this work?
> 
> Could you maybe provide a compilable example?

I would like but I can't condense it down to a useable case. What I 
found out is, if I use:

	auto childs_app = appender(&childs);
	childs_app ~= root;

things work. Does this give a hint why the plain straight version 
doesn't work? Maybe missing copy semantics or so? Just wild guessing 
here...

-- 
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



More information about the Digitalmars-d-learn mailing list