How to use import std.algorithm.iteration.permutations?

2020-04-19 Thread David Zaragoza via Digitalmars-d-learn
Hi When I try to build the following: import std.algorithm.iteration; void test(int[] array); void main() { int[] a = [1,1,2,2,3,3]; foreach (p; a.permutations) { test(p); } } I get the error: .\permutations_example.d(10): Error: function perm

Re: Compilation error while adding two shorts

2014-06-24 Thread David Zaragoza via Digitalmars-d-learn
Interesting info, I've never seen this behavior in C since the conversion is implicit as [2] notes. A simple cast resolves the problem in D: module main; int main(string[] argv){ short asd = 1; short qwe = cast(short)(asd + asd); return 0; } Thanks for your answer :)

Compilation error while adding two shorts

2014-06-23 Thread David Zaragoza via Digitalmars-d-learn
Hello I'm trying to compile the following program: module main; int main(string[] argv){ short asd = 1; short qwe = asd + asd; return 0; } And the compiler gives this error: C:\David>dmd simple simple.d(5): Error: cannot implicitly convert expression (cast(int)asd + c