-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Next version of the containers library #104
Conversation
|
Is it a good idea to add the docs to the git repo? It looks like it is adding a ton of bloat, every function has its' own html file. |
Yes, especially if we already use Travis to auto-generate the documentation and push it to the gh-pages branch: https://dlang-community.github.io/containers/index.html |
I either didn't know or forgot that there was a CI job set up to keep the gh-pages branch up-to-date. |
Fixes #63. |
A version of the library before these changes is tagged as https://github.com/dlang-community/containers/releases/tag/v0.7.0. |
src/containers/simdset.d
Outdated
@@ -110,6 +124,18 @@ version (D_InlineAsm_X86_64) struct SimdSet(T, Allocator = Mallocator) | |||
return true; | |||
} | |||
|
|||
/// ditto | |||
bool opOpAssign(string op)(T item) if (op == "~") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation.
src/containers/slist.d
Outdated
* Returns: the least recently inserted item. | ||
*/ | ||
auto back(this This)() inout @property | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
front
has a contract but this doesn't.
src/containers/treemap.d
Outdated
/** | ||
* Returns: the value associated with the given key, or the given `defaultValue`. | ||
*/ | ||
auto get(this This)(K key, lazy V defaultValue) inout @trusted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key
should probably be const
here.
src/containers/treemap.d
Outdated
* key = the key to look up | ||
* value = the default value | ||
*/ | ||
auto getOrAdd(this This)(K key, lazy V value) @safe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
src/containers/treemap.d
Outdated
/** | ||
* Returns: true if the mapping contains the given key | ||
*/ | ||
bool containsKey(K key) inout pure nothrow @nogc @safe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here.
src/containers/unrolledlist.d
Outdated
@@ -273,7 +294,7 @@ struct UnrolledList(T, Allocator = Mallocator, | |||
import containers.internal.backwards : bsf; | |||
import std.string: format; | |||
size_t index = bsf(_front.registry); | |||
assert (index < nodeCapacity, format("%d", index)); | |||
//assert (index < nodeCapacity, format("%d", index)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete or move to an in
contract.
src/containers/treemap.d
Outdated
* | ||
* Throws: RangeError if the key does not exist. | ||
*/ | ||
auto opIndex(this This)(K key) inout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const K
*/ | ||
bool insert(T value) | ||
size_t insert(T value, bool overwrite = false) @safe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should other containers also have overloads of insert
that take ranges and return size_t?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Putting this off until later: #105
@@ -133,74 +169,113 @@ struct TTree(T, Allocator = Mallocator, bool allowDuplicates = false, | |||
*/ | |||
bool remove(T value, void delegate(T) cleanup = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Figure out what should be done here when duplicates are enabled. This should probably return size_t
like insert
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Arbitrarily decided that
remove
would only remove a single element at a time - documented this behavior
- added a test
src/containers/ttree.d
Outdated
static if (is(typeof(less) == string )) | ||
{ | ||
|
||
static if (less == "a < b" && isPointer!T |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document why this terrible, horrible hack is needed.
Goals: