Report a bug
If you spot a problem with this page, click here to create a Github issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.


This is a submodule of mir.ndslice.
Field is a type with opIndex(ptrdiff_t index) primitive. An iterator can be created on top of a field using FieldIterator . An ndslice can be created on top of a field using slicedField .


Field Name Used By
BitpackField bitpack 
BitwiseField bitwise 
MapField map 
ndIotaField ndiota 
RepeatField repeat 
LinspaceField linspace 
Ilya Yaroshenko
struct MapField(Field, alias fun);
MapField is used by map .
Field _field;
template __map(alias fun1)
User defined constructor used by mapField.
auto mapField(alias fun, Field)(Field field);
Creates a mapped field. Uses __map if possible.
struct RepeatField(T);
RepeatField is used by repeat .
alias UT = Unqual!T;
UT _value;
struct BitwiseField(Field, I = typeof(Field.init[size_t.init])) if (isUnsigned!I);
BitwiseField is used by bitwise .
import mir.ndslice.iterator: FieldIterator;
   ushort[10] data;
   auto f = FieldIterator!(BitwiseField!(ushort*))(0, BitwiseField!(ushort*)(data.ptr));
   f[123] = true;
Field _field;
struct BitpackField(Field, uint pack, I = typeof(Field.init[size_t.init])) if (isUnsigned!I);
BitpackField is used by bitpack .
import mir.ndslice.iterator: FieldIterator;
ushort[10] data;
auto f = FieldIterator!(BitpackField!(ushort*, 6))(0, BitpackField!(ushort*, 6)(data.ptr));
f[0] = cast(ushort) 31;
f[1] = cast(ushort) 13;
f[2] = cast(ushort)  8;
f[3] = cast(ushort) 43;
f[4] = cast(ushort) 28;
f[5] = cast(ushort) 63;
f[6] = cast(ushort) 39;
f[7] = cast(ushort) 23;
f[8] = cast(ushort) 44;

assert(f[0] == 31);
assert(f[1] == 13);
assert(f[2] ==  8);
assert(f[3] == 43);
assert(f[4] == 28);
assert(f[5] == 63);
assert(f[6] == 39);
assert(f[7] == 23);
assert(f[8] == 44);
assert(f[9] == 0);
assert(f[10] == 0);
assert(f[11] == 0);
Field _field;
struct ndIotaField(size_t N) if (N);
ndIotaField is used by ndiota .
size_t[N - 1] _lengths;
struct LinspaceField(T);
LinspaceField is used by linspace .
size_t _length;
T start;
T stop;
T opIndex()(size_t index);