digitalmars.D - Object-based interface for a range of ranges
- =?UTF-8?B?THXDrXM=?= Marques (7/7) Jan 27 2016 This works:
- =?UTF-8?Q?Ali_=c3=87ehreli?= (14/20) Jan 27 2016 All I can say is the following compiles. I hope it works too. :)
This works: int[][] a; RandomAccessFinite!(int[]) r = inputRangeObject(a); What would be a good way to achieve something equivalent to this?: int[][] a; RandomAccessFinite!(RandomAccessFinite!int) r = inputRangeObject(a);
Jan 27 2016
On 01/27/2016 08:59 PM, Luís Marques wrote:This works: int[][] a; RandomAccessFinite!(int[]) r = inputRangeObject(a); What would be a good way to achieve something equivalent to this?: int[][] a; RandomAccessFinite!(RandomAccessFinite!int) r = inputRangeObject(a);All I can say is the following compiles. I hope it works too. :) import std.range; import std.algorithm; import std.conv; void main() { int[][] a; RandomAccessFinite!(RandomAccessFinite!int) r = inputRangeObject( a.map!(e => inputRangeObject(e).to!(RandomAccessFinite!int))); } Instead of to!(RandomAccessFinite!int) one can use the cast operator as well. Ali
Jan 27 2016