On Thursday, 8 November 2018 at 16:41:50 UTC, Steven
Schveighoffer wrote:
I did this in a run.dlang.org playground:
pragma(msg, ElementType!(typeof(b)));
pragma(msg, ElementType!(typeof(d)));
I get:
immutable(ubyte)
ubyte
Which means they aren't the same type, and they don't define
the same interface (InputRange!(ubyte) is not the same as
InputRange!(immutable(ubyte)) ).
Other than simply using compile-time functions, and dropping
the object interface as Alex suggests, the easiest thing I can
recommend is wrapping representation into a casting input range
such as map:
auto b = inputRangeObject(a.representation.map!(b => ubyte(b)));
You can see all this here:
https://run.dlang.io/is/1E6Uqj
-Steve
Thanks, guys, those are helpful pointers.