@@ -879,15 +879,16 @@ if (is(typeof(binaryFun!less(T.init, T.init))))
879
879
* Returns:
880
880
* true if node was added
881
881
*/
882
- private bool _add (Elem n)
882
+ private bool _add (return Elem n)
883
883
{
884
884
Node result;
885
885
static if (! allowDuplicates)
886
886
bool added = true ;
887
887
888
888
if (! _end.left)
889
889
{
890
- _end.left = _begin = result = allocate(n);
890
+ result = allocate(n);
891
+ (() @trusted { _end.left = _begin = result; }) ();
891
892
}
892
893
else
893
894
{
@@ -903,7 +904,8 @@ if (is(typeof(binaryFun!less(T.init, T.init))))
903
904
//
904
905
// add to right of new parent
905
906
//
906
- newParent.left = result = allocate(n);
907
+ result = allocate(n);
908
+ (() @trusted { newParent.left = result; }) ();
907
909
break ;
908
910
}
909
911
}
@@ -924,7 +926,8 @@ if (is(typeof(binaryFun!less(T.init, T.init))))
924
926
//
925
927
// add to right of new parent
926
928
//
927
- newParent.right = result = allocate(n);
929
+ result = allocate(n);
930
+ (() @trusted { newParent.right = result; }) ();
928
931
break ;
929
932
}
930
933
}
@@ -933,7 +936,6 @@ if (is(typeof(binaryFun!less(T.init, T.init))))
933
936
if (_begin.left)
934
937
_begin = _begin.left;
935
938
}
936
-
937
939
static if (allowDuplicates)
938
940
{
939
941
result.setColor(_end);
@@ -944,8 +946,6 @@ if (is(typeof(binaryFun!less(T.init, T.init))))
944
946
}
945
947
else
946
948
{
947
- import std.typecons : Tuple ;
948
-
949
949
if (added)
950
950
{
951
951
++ _length;
@@ -1144,12 +1144,14 @@ if (is(typeof(binaryFun!less(T.init, T.init))))
1144
1144
{
1145
1145
int x;
1146
1146
1147
+ @safe :
1148
+
1147
1149
this (int init_x)
1148
1150
{
1149
1151
x = init_x;
1150
1152
}
1151
1153
1152
- size_t toHash () const @safe nothrow
1154
+ size_t toHash () const nothrow
1153
1155
{
1154
1156
return typeid (x).getHash(&x) ^ 0xF0F0_F0F0;
1155
1157
}
@@ -1272,7 +1274,9 @@ if (is(typeof(binaryFun!less(T.init, T.init))))
1272
1274
*
1273
1275
* Complexity: $(BIGOH m * log(n))
1274
1276
*/
1275
- size_t stableInsert (Stuff)(Stuff stuff) if (isInputRange! Stuff && isImplicitlyConvertible! (ElementType! Stuff, Elem))
1277
+ size_t stableInsert (Stuff)(scope Stuff stuff)
1278
+ if (isInputRange! Stuff &&
1279
+ isImplicitlyConvertible! (ElementType! Stuff, Elem))
1276
1280
{
1277
1281
size_t result = 0 ;
1278
1282
static if (allowDuplicates)
@@ -1529,7 +1533,7 @@ assert(equal(rbt[], [5]));
1529
1533
}
1530
1534
1531
1535
/+ + Ditto +/
1532
- size_t removeKey (U)(U[] elems)
1536
+ size_t removeKey (U)(scope U[] elems)
1533
1537
if (isImplicitlyConvertible! (U, Elem))
1534
1538
{
1535
1539
immutable lenBefore = length;
@@ -1777,7 +1781,7 @@ assert(equal(rbt[], [5]));
1777
1781
* Check the tree for validity. This is called after every add or remove.
1778
1782
* This should only be enabled to debug the implementation of the RB Tree.
1779
1783
*/
1780
- void check ()
1784
+ void check () @trusted
1781
1785
{
1782
1786
//
1783
1787
// check implementation of the tree
0 commit comments