October 04, 2014 [Issue 13571] New: Overload of std.range.tee which accepts a functions does not accept structs or classes with opCall | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13571 Issue ID: 13571 Summary: Overload of std.range.tee which accepts a functions does not accept structs or classes with opCall Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: DMD Assignee: nobody@puremagic.com Reporter: monkeyworks12@hotmail.com The following code does not work currently with tee: struct Callable { void opCall(int n) { writeln(n); } } void main() { auto ints = [1, 2, 3]; //Error auto res = ints.tee!Callable; } Note that the following code *does* work: struct Callable { void opCall(int n) { writeln(n); } } void main() { Callable callable; auto ints = [1, 2, 3]; auto r = ints.tee(callable); foreach (_; r) {} //Prints 1 2 3 } So I don't know how useful adding support for doing `tee!Callable` would be. -- |
Copyright © 1999-2021 by the D Language Foundation