-
-
Notifications
You must be signed in to change notification settings - Fork 743
Improvements to RedBlackTree #10
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
Conversation
1. It's now a class. The only constructor is now the default constructor (since templatizing the constructors does not appear to currently work). 2. It now has a helper function - redBlackTree - for creating it. 3. It now has a length property. 4. It now has a version of remove which takes a Take!Range. 5. It now has removeKey to allow you to remove one or more elements by value from it.
Probably can remove the comment about Bug 2810, I think that was just fixed. However, I haven't tested yet... |
It is probably not necessary to add length checks to so many unit tests. |
BTW, I like the scope(success) usage to alter length, I'm going to steal that idea for dcollections too ;) |
@schveiguy I could probably remove length from some of the unit tests, but given all of the various places that length has to be changed, it seemed a lot safer to just be thorough about it. |
Overall: looks good, need to fix that remove+Take function (see comment about what should be returned when removing an empty range). |
…-Programming-Language/Phobos. I think that I took all of the suggestions into account, so it should be improved per those suggestions. I also beefed up the unit tests a bit in order to take different less and allowDuplicate values into account (previously, it was only testing the defaults for those template parameters).
I've made the changes as suggested and improved the unit tests a bit. |
I tried to merge this, by following the instructions. However, unittests fail: std/datetime.d(28538): Error: undefined identifier tzname, did you mean function name? What's going on? |
Update druntime. The declaration of tzname got moved to drutime where it belongs. |
Done. |
…-Programming-Language/Phobos. I think that I took all of the suggestions into account, so it should be improved per those suggestions. I also beefed up the unit tests a bit in order to take different less and allowDuplicate values into account (previously, it was only testing the defaults for those template parameters).
some more docu fixes fatel -> fatal changed the way of calling some rework some better comments and win32.mak fix more documentation trying to figure out why win32 fails test before you commit another try to work around windows files and processes maybe this time maybe this merges update 1 mostly soenke MultiLogger and Logger have names more docu unittest fix some better comments and win32.mak fix Conflicts: std/logger.d antoher doc fix less code dup and more log functions docs are now generated some more fixing speedup some threading forgot some better docu gen and more testing two new LogLevel, most functions are now at least @trusted Tracer functionality fatal delegate some phobos style fixes another bug bites the dust version disable enhancements default global LogLevel set to LogLevel.all logLevel compare bugfix delete of dead code tab to whitespace bugfixes, reduandency removal, and docu multilogger was logging to all it childs without checking there LogLevel in relation to the LogLevel of the LoggerPayload. Some constructors where redundant. more examples and more documentation some fixes NullLogger and moduleName wrong doc I splitted the multi logger implementations out loglevelF to loglevelf in order to make phobos style think writefln document building win makefile fixes some optimizations thanks to @elendel- some whitespace some updates from the github logger project * stdio- and filelogger now use a templatelogger base to reduce code makefile fixes makefile fixed the unittest made sure the stdiologger is set up at the end some comment fixes finding the filelogger segfault closed another file a lookup fix darwin unittest fail output more diagnostics * more documentation for the templatelogger and multilogger * it breaks the log function api * log and logf now behave as their write and writef counterparts * for logging with an explicit LogLevel call logl loglf * for logging with an explicit condition call logc logcf * for logging with an explicit LogLevel and explicit condition call * loglc loglcf * the log function with an explicit LogLevel like info, warning, ... * can be extended into c, f or cf and therefore require a condition * and/or are printf functions something is still interesting rebase and lazy Args saver file handling whitespace some updates tracer is gone and more doc updates codegen rework to allow log function comments thread safe and concur works comments for free standing log functions fixes dlang#10 * free log function doco * StdIOLogger prints now threadsafe * concurrentcy hang fix more docu old file even more doc typo * more better doc * makefile fix another fix more unittests nearl 100% everywhere another test no more mixins more doc win64 please pass fixes from the review and voting hope this fixes it more comments more docs more tests more docu more doc and fixes from jacob-carlborg LogEntry.logger reference more fixes fileptr is gone logger move to experimental/logger type in win32/64 makefile win makefile nogc and threading makefile fixes some log calls take line and file as parameter
some more docu fixes fatel -> fatal changed the way of calling some rework some better comments and win32.mak fix more documentation trying to figure out why win32 fails test before you commit another try to work around windows files and processes maybe this time maybe this merges update 1 mostly soenke MultiLogger and Logger have names more docu unittest fix some better comments and win32.mak fix Conflicts: std/logger.d antoher doc fix less code dup and more log functions docs are now generated some more fixing speedup some threading forgot some better docu gen and more testing two new LogLevel, most functions are now at least @trusted Tracer functionality fatal delegate some phobos style fixes another bug bites the dust version disable enhancements default global LogLevel set to LogLevel.all logLevel compare bugfix delete of dead code tab to whitespace bugfixes, reduandency removal, and docu multilogger was logging to all it childs without checking there LogLevel in relation to the LogLevel of the LoggerPayload. Some constructors where redundant. more examples and more documentation some fixes NullLogger and moduleName wrong doc I splitted the multi logger implementations out loglevelF to loglevelf in order to make phobos style think writefln document building win makefile fixes some optimizations thanks to @elendel- some whitespace some updates from the github logger project * stdio- and filelogger now use a templatelogger base to reduce code makefile fixes makefile fixed the unittest made sure the stdiologger is set up at the end some comment fixes finding the filelogger segfault closed another file a lookup fix darwin unittest fail output more diagnostics * more documentation for the templatelogger and multilogger * it breaks the log function api * log and logf now behave as their write and writef counterparts * for logging with an explicit LogLevel call logl loglf * for logging with an explicit condition call logc logcf * for logging with an explicit LogLevel and explicit condition call * loglc loglcf * the log function with an explicit LogLevel like info, warning, ... * can be extended into c, f or cf and therefore require a condition * and/or are printf functions something is still interesting rebase and lazy Args saver file handling whitespace some updates tracer is gone and more doc updates codegen rework to allow log function comments thread safe and concur works comments for free standing log functions fixes #10 * free log function doco * StdIOLogger prints now threadsafe * concurrentcy hang fix more docu old file even more doc typo * more better doc * makefile fix another fix more unittests nearl 100% everywhere another test no more mixins more doc win64 please pass fixes from the review and voting hope this fixes it more comments more docs more tests more docu more doc and fixes from jacob-carlborg LogEntry.logger reference more fixes fileptr is gone logger move to experimental/logger type in win32/64 makefile win makefile nogc and threading makefile fixes some log calls take line and file as parameter
Here are some improvements to RedBlackTree as discussed in the newsgroup. It should improve the remove situation and deals with most everything listed in http://d.puremagic.com/issues/show_bug.cgi?id=5451 . I also made it a class, since we're planning to change all of the containers to std.container, and making it a class fixes the default construction problem that it had.
Steven should probably have a look at this before it gets merged in, though I have no idea when he'll get around to that, since he hasn't gotten around to figuring out git yet. So, if multiple other folks look at it and think that it's good though, then we should probably just merge it in and let Steven worry about making whatever changes he thinks are appropriate later. Certainly, these changes make RedBlackTree more usable.