Skip to content

Commit

Permalink
Fixed an attribute hell issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ZILtoid1991 committed Oct 3, 2022
1 parent 6047990 commit 08b1396
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 24 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ docs/

# Code coverage
*.lst

*.pdb
7 changes: 3 additions & 4 deletions source/collections/commons.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ module collections.commons;
import std.digest.murmurhash;

///Contains all possible basic attributes that might be used in a foreach situation
static immutable string[] attrList = ["@trusted", "@safe", "@nogc", "nothrow", "pure",
"@nogc nothrow", "@nogc pure", "nothrow pure", "@nogc nothrow pure",
/+"@trusted @nogc nothrow", "@trusted @nogc pure", "@trusted nothrow pure", "@trusted @nogc nothrow pure",+/
"@safe @nogc nothrow", "@safe @nogc pure", "@safe nothrow pure", "@safe @nogc nothrow pure",];
static immutable string[] attrList = ["@safe", "@nogc", "nothrow", "pure",
"@nogc nothrow", "@nogc pure", "nothrow pure", "@nogc nothrow pure", "@safe nothrow",
"@safe @nogc nothrow", "@safe @nogc pure", "@safe nothrow pure", "@safe @nogc nothrow pure"];
///Generates overrides to be mixed in with regular code
string generateOverrides()(){
string result;
Expand Down
3 changes: 3 additions & 0 deletions source/collections/sortedlist.d
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,9 @@ public struct SortedList(E, alias cmp = "a < b", bool allowDuplicates = true, al
foreach(e; sis) {
writeln(e);
}
SortedIntList a = SortedIntList([0]);
a.remove(0);
assert(a.length == 0);
}

@safe unittest {
Expand Down
20 changes: 0 additions & 20 deletions source/collections/treemap.d
Original file line number Diff line number Diff line change
Expand Up @@ -829,26 +829,6 @@ public struct TreeMap(K, E, bool nogcIndexing = true, alias less = "a < b") {
public @property size_t length() @nogc @safe pure nothrow const {
return nOfElements;
}
/**
* Returns the key of the n-th element.
* NOT WORKING!
*/
/+public K keyOf(size_t n) {
static if(E.stringof != "void"){
foreach (key, elem; root) {
if (n == 0) {
return key;
} else n--;
}
} else {
foreach (key; root) {
if (n == 0) {
return key;
} else n--;
}
}
return K.init;
}+/
/**
* Returns the string representation of the tree.
*/
Expand Down

0 comments on commit 08b1396

Please sign in to comment.