Re: How to get type returned by e.g. std.algorithm.iteration.filter

2019-05-19 Thread Christian Köstlin via Digitalmars-d-learn
Last version using more from the outer template #!/usr/bin/env rdmd import std.stdio; import std.algorithm; import std.typecons; import std.array; import std.range; import std.traits; auto byMinimum(Ranges)(Ranges ranges) { auto getNonEmpty() { return ranges.filter!("!a.empty");

Re: How to get type returned by e.g. std.algorithm.iteration.filter

2019-05-19 Thread Christian Köstlin via Digitalmars-d-learn
On 19.05.19 20:38, Jacob Carlborg wrote: On 2019-05-19 15:36, Christian Köstlin wrote: Unfortunately I have no idea how to even store the result of this search in an attribute of ByMinimum, as I cannot writeout its type. In general you can use `typeof()`, where `` is the expression you want

Re: How to get type returned by e.g. std.algorithm.iteration.filter

2019-05-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2019-05-19 15:36, Christian Köstlin wrote: Unfortunately I have no idea how to even store the result of this search in an attribute of ByMinimum, as I cannot writeout its type. In general you can use `typeof()`, where `` is the expression you want to get the type of. -- /Jacob Carlborg

How to get type returned by e.g. std.algorithm.iteration.filter

2019-05-19 Thread Christian Köstlin via Digitalmars-d-learn
I would like to join several sorted files into one big sorted file. For that I came up with this snippet: #!/usr/bin/env rdmd import std.stdio; import std.algorithm; import std.typecons; import std.array; import std.range; auto byMinimum(Ranges)(Ranges ranges) { auto getNonEmpty() {