Skip to content

Commit 37eefef

Browse files
committed
ditto
1 parent 427c732 commit 37eefef

File tree

3 files changed

+5
-36
lines changed

3 files changed

+5
-36
lines changed

source/mir/rc/array.d

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -423,47 +423,16 @@ template rcarray(T)
423423
}
424424
}
425425

426-
/// ditto
427-
RCArray!T rcarray(V)(V[] values...)
428-
if (hasIndirections!V)
429-
{
430-
return .rcarray!T(values, true);
431-
}
432-
433426
/// ditto
434427
RCArray!T rcarray(V)(scope V[] values...)
435-
if (!hasIndirections!V)
436428
{
437429
return .rcarray!T(values, true);
438430
}
439431

440-
/// ditto
441-
RCArray!T rcarray(V)(V[] values, bool deallocate)
442-
if (hasIndirections!V)
443-
{
444-
auto ret = mir_rcarray!T(values.length, false, deallocate);
445-
static if (!hasElaborateAssign!(Unqual!T) && is(Unqual!V == Unqual!T))
446-
{
447-
()@trusted {
448-
import core.stdc.string: memcpy;
449-
memcpy(cast(void*)ret.ptr, cast(const void*)values.ptr, values.length * T.sizeof);
450-
}();
451-
}
452-
else
453-
{
454-
import mir.conv: emplaceRef;
455-
auto lhs = ret[];
456-
foreach (i, ref e; values)
457-
lhs[i].emplaceRef!T(e);
458-
}
459-
return ret;
460-
}
461-
462432
/// ditto
463433
RCArray!T rcarray(V)(scope V[] values, bool deallocate)
464-
if (!hasIndirections!V)
465434
{
466-
auto ret = mir_rcarray!T(values.length, false);
435+
auto ret = mir_rcarray!T(values.length, hasElaborateDestructor!T, deallocate);
467436
static if (!hasElaborateAssign!(Unqual!T) && is(Unqual!V == Unqual!T))
468437
{
469438
()@trusted {

source/mir/small_array.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,10 @@ template SmallArray(T, uint maxLength)
309309

310310
auto s8 = SmallArray!(char, 8)("Hellow!!");
311311
assert(!s8.empty);
312-
assert(s8 == "Hellow!!", s8[]);
312+
assert(s8 == "Hellow!!");
313313

314314
s16 = s8;
315-
assert(s16 == "Hellow!!", s16[]);
315+
assert(s16 == "Hellow!!");
316316
s16[7] = '@';
317317
s8 = null;
318318
assert(s8.empty);

source/mir/small_string.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,13 +311,13 @@ const:
311311
assert(s16.empty);
312312

313313
auto s8 = SmallString!8("Hellow!!");
314-
assert(s8 == "Hellow!!", s8[]);
314+
assert(s8 == "Hellow!!");
315315
assert(s8[] == "Hellow!!");
316316
assert(s8[0 .. $] == "Hellow!!");
317317
assert(s8[1 .. 4] == "ell");
318318

319319
s16 = s8;
320-
assert(s16 == "Hellow!!", s16[]);
320+
assert(s16 == "Hellow!!");
321321
s16[7] = '@';
322322
s8 = null;
323323
assert(s8.empty);

0 commit comments

Comments
 (0)