Skip to content

Commit 19e1387

Browse files
committed
fix rcarray for const types
1 parent b4450d6 commit 19e1387

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

source/mir/rcarray.d

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,10 @@ struct mir_rcarray(T)
111111
{
112112
if (counter.atomicOp!"-="(1) == 0)
113113
{
114+
import std.traits: Unqual;
114115
import mir.conv: xdestroy;
115-
T[] array;
116-
()@trusted { array = (cast(T*)(_context + 1))[0 .. length]; }();
116+
Unqual!T[] array;
117+
()@trusted { array = (cast(Unqual!T*)(_context + 1))[0 .. length]; }();
117118
xdestroy(array);
118119
() @trusted {
119120
auto p = cast(void*) _payload;
@@ -244,13 +245,13 @@ struct mir_rcarray(T)
244245
}
245246

246247
///
247-
size_t length() @trusted scope pure nothrow @nogc @property
248+
size_t length() @trusted scope pure nothrow @nogc const @property
248249
{
249250
return _context !is null ? _context.length : 0;
250251
}
251252

252253
///
253-
size_t counter() @trusted scope pure nothrow @nogc @property
254+
size_t counter() @trusted scope pure nothrow @nogc const @property
254255
{
255256
return _context !is null ? _context.counter : 0;
256257
}

0 commit comments

Comments
 (0)