@@ -13,7 +13,7 @@ Checks if the type is instance of $(LREF StringMap).
13
13
+/
14
14
enum isStringMap (T) = is (Unqual! T == StringMap! V, V);
15
15
16
- version (mir_test)
16
+ version (mir_test)
17
17
// /
18
18
unittest
19
19
{
@@ -297,10 +297,10 @@ struct StringMap(T, U = uint)
297
297
}
298
298
299
299
/+ +
300
- Reserves capacity for an associative array.
300
+ Reserves capacity for an associative array.
301
301
The capacity is the size that the underlaying slices can grow to before the underlying arrays may be reallocated or extended.
302
302
+/
303
- size_t reserve ()(size_t newcapacity) @trusted pure nothrow
303
+ size_t reserve ()(size_t newcapacity) @trusted pure nothrow
304
304
{
305
305
import mir.utility: min;
306
306
@@ -355,7 +355,7 @@ struct StringMap(T, U = uint)
355
355
356
356
Returns: The input is returned.
357
357
+/
358
- ref inout (typeof (this )) assumeSafeAppend ()() @system nothrow inout return
358
+ ref inout (typeof (this )) assumeSafeAppend ()() nothrow inout return
359
359
{
360
360
if (implementation)
361
361
{
@@ -442,7 +442,7 @@ struct StringMap(T, U = uint)
442
442
443
443
/+ +
444
444
Finds position of the key in the associative array .
445
-
445
+
446
446
Return: An index starting from `0` that corresponds to the key or `-1` if the associative array doesn't contain the key.
447
447
448
448
Complexity: `O(log(s))`, where `s` is the number of the keys with the same length as the input key.
@@ -481,7 +481,7 @@ struct StringMap(T, U = uint)
481
481
/+ +
482
482
Complexity: `O(log(s))`, where `s` is the number of the keys with the same length as the input key.
483
483
+/
484
- inout (T)* opBinaryRight (string op : " in" )(scope const (char )[] key) @system pure nothrow @nogc inout
484
+ inout (T)* opBinaryRight (string op : " in" )(scope const (char )[] key) pure nothrow @nogc inout
485
485
{
486
486
if (! implementation)
487
487
return null ;
@@ -491,12 +491,12 @@ struct StringMap(T, U = uint)
491
491
assert (index < length);
492
492
index = implementation.indices[index];
493
493
assert (index < length);
494
- return implementation._values + index;
494
+ return & implementation.values [ index] ;
495
495
}
496
496
497
497
version (mir_test) static if (is (T == int ))
498
498
// /
499
- @system nothrow pure unittest
499
+ @safe nothrow pure unittest
500
500
{
501
501
StringMap! double map;
502
502
assert ((" c" in map) is null );
@@ -712,7 +712,7 @@ struct StringMap(T, U = uint)
712
712
}
713
713
}
714
714
715
- version (mir_test)
715
+ version (mir_test)
716
716
// /
717
717
unittest
718
718
{
@@ -888,17 +888,17 @@ private struct StructImpl(T, U = uint)
888
888
{
889
889
return _keys[0 .. _length];
890
890
}
891
-
891
+
892
892
inout (T)[] values ()() @trusted inout @property
893
893
{
894
894
return _values[0 .. _length];
895
895
}
896
-
896
+
897
897
inout (U)[] indices ()() @trusted inout @property
898
898
{
899
899
return _indices[0 .. _length];
900
900
}
901
-
901
+
902
902
inout (U)[] lengthTable ()() @trusted inout @property
903
903
{
904
904
return _lengthTable;
@@ -923,7 +923,7 @@ private struct StructImpl(T, U = uint)
923
923
auto high = _lengthTable[key.length + 1 ] + 0u ;
924
924
while (low < high)
925
925
{
926
- auto mid = (low + high) / 2 ;
926
+ const mid = (low + high) / 2 ;
927
927
928
928
import core.stdc.string : memcmp;
929
929
int r = void ;
@@ -950,7 +950,7 @@ private struct StructImpl(T, U = uint)
950
950
}
951
951
952
952
version (mir_test)
953
- unittest
953
+ @safe unittest
954
954
{
955
955
import mir.algebraic_alias.json: JsonAlgebraic;
956
956
import mir.string_map: StringMap;
0 commit comments