File tree Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -53,13 +53,13 @@ struct SmallArray(T, uint maxLength)
53
53
}
54
54
55
55
// / ditto
56
- this (SmallArray array) nothrow
56
+ this (const SmallArray array) nothrow
57
57
{
58
58
this .opAssign(array);
59
59
}
60
60
61
61
// / ditto
62
- this (uint n)(SmallArray! (T, n) array)
62
+ this (uint n)(const SmallArray! (T, n) array)
63
63
{
64
64
this .opAssign(array);
65
65
}
@@ -116,7 +116,7 @@ struct SmallArray(T, uint maxLength)
116
116
}
117
117
118
118
// / ditto
119
- ref typeof (this ) opAssign (SmallArray rhs) return nothrow
119
+ ref typeof (this ) opAssign (const SmallArray rhs) return nothrow
120
120
{
121
121
_length = rhs._length;
122
122
_data = rhs._data;
@@ -147,7 +147,7 @@ struct SmallArray(T, uint maxLength)
147
147
}
148
148
149
149
// / ditto
150
- ref typeof (this ) opAssign (uint n)(SmallArray! (T, n) rhs) return
150
+ ref typeof (this ) opAssign (uint n)(const SmallArray! (T, n) rhs) return
151
151
if (n != maxLength)
152
152
{
153
153
static if (n < maxLength)
Original file line number Diff line number Diff line change @@ -61,13 +61,13 @@ extern(D):
61
61
}
62
62
63
63
// / ditto
64
- this (SmallString str) nothrow
64
+ this (const SmallString str) nothrow
65
65
{
66
66
this .opAssign(str);
67
67
}
68
68
69
69
// / ditto
70
- this (uint n)(SmallString! n str)
70
+ this (uint n)(const SmallString! n str)
71
71
{
72
72
this .opAssign(str);
73
73
}
@@ -124,7 +124,7 @@ extern(D):
124
124
}
125
125
126
126
// / ditto
127
- ref typeof (this ) opAssign (SmallString rhs) return nothrow
127
+ ref typeof (this ) opAssign (const SmallString rhs) return nothrow
128
128
{
129
129
_data = rhs._data;
130
130
return this ;
@@ -149,12 +149,13 @@ extern(D):
149
149
version (D_Exceptions) throw exception;
150
150
else assert (0 , errorMsg);
151
151
}
152
- _data = cast (char [0 .. maxLength])(rhs._data[0 .. maxLength]);
152
+ _data = cast (char [maxLength])(rhs._data[0 .. maxLength]);
153
153
}
154
+ return this ;
154
155
}
155
156
156
157
// / ditto
157
- ref typeof (this ) opAssign (uint n)(SmallString! n rhs) return
158
+ ref typeof (this ) opAssign (uint n)(const SmallString! n rhs) return
158
159
if (n != maxLength)
159
160
{
160
161
static if (n < maxLength)
@@ -330,3 +331,10 @@ const:
330
331
b.put(" !" );
331
332
assert (b == " asdf qwerty!!" );
332
333
}
334
+
335
+ @safe pure @nogc nothrow version(mir_test) unittest
336
+ {
337
+ import mir.conv: emplaceRef;
338
+ SmallString! 32 a, b;
339
+ emplaceRef! (const SmallString! 32 )(a, cast (const )b);
340
+ }
You can’t perform that action at this time.
0 commit comments