Skip to content

Commit d10bcb3

Browse files
authored
Document orderness of the return values of the StringMap members keys(), values() and byKeyValue() (#398)
* Correct mis-spelling of associative * Document orderness of the return values of the StringMap members keys(), values() and byKeyValue()
1 parent 93ead59 commit d10bcb3

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

source/mir/string_map.d

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/++
2-
$(H1 Ordered string-value associtaive array)
2+
$(H1 Ordered string-value associative array)
33
Macros:
44
AlgebraicREF = $(GREF_ALTTEXT mir-core, $(TT $1), $1, mir, algebraic)$(NBSP)
55
+/
@@ -23,7 +23,7 @@ unittest
2323
}
2424

2525
/++
26-
Ordered string-value associtaive array with extremely fast lookup.
26+
Ordered string-value associative array with extremely fast lookup.
2727
2828
Params:
2929
T = mutable value type, can be instance of $(AlgebraicREF Algebraic) for example.
@@ -113,7 +113,7 @@ struct StringMap(T, U = uint)
113113
// }
114114

115115
/++
116-
Reset the associtave array
116+
Reset the associative array
117117
+/
118118
ref opAssign()(typeof(null)) return @safe pure nothrow @nogc
119119
{
@@ -130,7 +130,7 @@ struct StringMap(T, U = uint)
130130
}
131131

132132
/++
133-
Initialize the associtave array with default value.
133+
Initialize the associative array with default value.
134134
+/
135135
this()(typeof(null) aa) @safe pure nothrow @nogc
136136
{
@@ -245,6 +245,9 @@ struct StringMap(T, U = uint)
245245
Returns a dynamic array, the elements of which are the keys in the associative array.
246246
Doesn't allocate a new copy.
247247
248+
The keys returned are guaranteed to be in the ordered inserted as long as no
249+
key removals followed by at least one key insertion has been performed.
250+
248251
Complexity: `O(1)`
249252
+/
250253
const(string)[] keys()() @safe pure nothrow @nogc const @property
@@ -276,6 +279,9 @@ struct StringMap(T, U = uint)
276279
Returns a dynamic array, the elements of which are the values in the associative array.
277280
Doesn't allocate a new copy.
278281
282+
The values returned are guaranteed to be in the ordered inserted as long as no
283+
key removals followed by at least one key insertion has been performed.
284+
279285
Complexity: `O(1)`
280286
+/
281287
inout(T)[] values()() @safe pure nothrow @nogc inout @property
@@ -297,7 +303,11 @@ struct StringMap(T, U = uint)
297303
assert(map.byKeyValue == [StringMap!double.KeyValue("c", 4.0), StringMap!double.KeyValue("a", 3.0)]);
298304
}
299305

300-
///
306+
/** Return a range over all elements (key-values pairs) currently stored in the associative array.
307+
308+
The elements returned are guaranteed to be in the ordered inserted as
309+
long as no key removals nor no value mutations has been performed.
310+
*/
301311
auto byKeyValue(this This)() @trusted pure nothrow @nogc
302312
{
303313
import mir.ndslice.topology: zip, map;

0 commit comments

Comments
 (0)