Skip to content

Conversation

@lilrachel1985
Copy link

can you explain how this can be done

BenFrantzDale and others added 30 commits October 3, 2014 16:32
Revert "Change spurious use of malloc to new"
Cleanup: Remove "using namespace std;" and add constness to searches.
return value type fix & change default value type
fixed clang compilation error
Replace hard-coded compiler for portability.
When code like:

    intervalTree a; //Fill a
    intervalTree b; //Fill b
    b=a;

was executed, b's contents would not get deleted before being
overwritten by a copy of a's contents. Though I could have fixed the
bug directly, I fixed that class of bugs by making left and right
unique_ptr. Changing to unique_ptr also simplified the code allowing
the destructor to be defaulted and the assignment code for left and
right to be reduced to two assignments. (If we were using C++ 14 the
copyTree helper function could have been omitted too since it has
make_unique.)
Rather than reinventing the wheel to add the unit tests, I just added
the single-include header from the Catch unit-test framework.

https://github.com/philsquared/Catch
Two places in the code did not need modifiable references: copyTree
and the iteration over the intervals. I also made a note that the
from-vector constructor changes the order of its input vector.
…rvals to values.

Remove default template argument.
…non-const reference!) and makes use of the rvalue reference for efficency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants