-   Notifications  You must be signed in to change notification settings 
- Fork 36
Closed
Description
mir.math.sum doesn't work with slices where the container itself is const. So for instance, it fails with const(Slice!T*), but not const(Slice!(const(T)*)).
The error it gives here is pretty long, but my testing suggests that the source of the problem is the use of core.lifetime.move. isIterable is true and elementType will Unqual any type that should be getting fed through.
unittest { import mir.math.sum: sum; import mir.ndslice.slice: sliced; double[] x = [0.0, 1, 2]; auto y = x.sliced; assert(y.sum == 3); //no error auto z = y.toConst; assert(z.sum == 3); //no error const z2 = y; //assert(z2.sum == 3); //error for type: const(mir.ndslice.slice.mir_slice!(double*, 1uL, 2).mir_slice) const z3 = y.toConst; //assert(z3.sum == 3); //error for type: const(mir.ndslice.slice.mir_slice!(const(double)*, 1uL, 2).mir_slice) }Metadata
Metadata
Assignees
Labels
No labels