Skip to content

Commit 439b9d2

Browse files
committed
fix length/shape
1 parent ab9f90e commit 439b9d2

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

source/mir/interpolate/package.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ struct Interp1(Range, Interpolant)
117117

118118
static if (hasLength!Range)
119119
/// Length (optional)
120-
size_t length()() @property { return _range.length; }
120+
size_t length()() const @property { return _range.length; }
121121
/// Save primitive (optional)
122122
auto save()() @property
123123
{

source/mir/ndslice/field.d

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,19 +106,19 @@ struct MapField(Field, alias _fun)
106106
}
107107

108108
static if (__traits(hasMember, Field, "length"))
109-
auto length() @property
109+
auto length() const @property
110110
{
111111
return _field.length;
112112
}
113113

114114
static if (__traits(hasMember, Field, "shape"))
115-
auto shape() @property
115+
auto shape() const @property
116116
{
117117
return _field.shape;
118118
}
119119

120120
static if (__traits(hasMember, Field, "elementCount"))
121-
auto elementCount() @property
121+
auto elementCount() const @property
122122
{
123123
return _field.elementCount;
124124
}
@@ -167,19 +167,19 @@ struct VmapField(Field, Fun)
167167
}
168168

169169
static if (__traits(hasMember, Field, "length"))
170-
auto length() @property
170+
auto length() const @property
171171
{
172172
return _field.length;
173173
}
174174

175175
static if (__traits(hasMember, Field, "shape"))
176-
auto shape() @property
176+
auto shape() const @property
177177
{
178178
return _field.shape;
179179
}
180180

181181
static if (__traits(hasMember, Field, "elementCount"))
182-
auto elementCount() @property
182+
auto elementCount()const @property
183183
{
184184
return _field.elementCount;
185185
}

source/mir/ndslice/ndfield.d

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ struct Cartesian(NdFields...)
8181
}
8282

8383
///
84-
size_t length(size_t d = 0)() @property
84+
size_t length(size_t d = 0)() const @property
8585
{
8686
foreach(f, ref field; _fields)
8787
static if (M!f <= d && M!(f + 1) > d)
@@ -95,7 +95,7 @@ struct Cartesian(NdFields...)
9595
}
9696

9797
///
98-
size_t[N] shape()() @property
98+
size_t[N] shape()() const @property
9999
{
100100
typeof(return) ret;
101101
foreach(f, ref field; _fields)
@@ -115,7 +115,7 @@ struct Cartesian(NdFields...)
115115
}
116116

117117
///
118-
size_t elementCount()() @property
118+
size_t elementCount()() const @property
119119
{
120120
size_t ret = 1;
121121
foreach (ref field; _fields)
@@ -168,7 +168,7 @@ struct Kronecker(alias fun, NdFields...)
168168
private enum N = DimensionCount!(NdFields[$-1]);
169169

170170
///
171-
size_t length(size_t d = 0)() @property
171+
size_t length(size_t d = 0)() const @property
172172
{
173173
static if (d == 0)
174174
{
@@ -187,7 +187,7 @@ struct Kronecker(alias fun, NdFields...)
187187

188188

189189
///
190-
size_t[N] shape()() @property
190+
size_t[N] shape()() const @property
191191
{
192192
static if (N > 1)
193193
{
@@ -211,7 +211,7 @@ struct Kronecker(alias fun, NdFields...)
211211
}
212212

213213
///
214-
size_t elementCount()() @property
214+
size_t elementCount()() const @property
215215
{
216216
size_t ret = 1;
217217
foreach (ref field; _fields)

0 commit comments

Comments
 (0)