std.algorithm Map using a external variable

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Dec 10 10:57:56 PST 2012


On Mon, Dec 10, 2012 at 07:21:47PM +0100, Zardoz wrote:
> I'm trying to use Map with a code like this :
> 
> ...
>   immutable int m = 10;
>   int[] caca = [1,2,3,4];
> 
>   auto caca2 = map!( (a) {return a * m;})(caca);
> 
>   writeln(caca2);
> ...
> 
> I get a Segmentation fault some times:
> The most interesting point it's that depends of the code around of
> it ins the same  program. for example If a use getopt at the begin
> of my program, then seg fault, etc...
[...]

Do you have a compilable sample (possibly reduced from your full
sources) that exhibits this error? It would help track down the problem.

There are some known bugs related to map in older releases of D that may
be affecting you.


T

-- 
Give me some fresh salted fish, please.


More information about the Digitalmars-d-learn mailing list