[Bug 2046] RBTree header files are not C++ compatible

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Fri Mar 30 15:52:37 UTC 2012


https://www.rtems.org/bugzilla/show_bug.cgi?id=2046

--- Comment #3 from Gedare <gedare at rtems.org> 2012-03-30 10:52:37 CDT ---
(In reply to comment #2)
> Do we need the enum? Duplicates is equal to not unique?

I don't think the enum is necessary. An rbtree either contains duplicates or it
does not, so the two cases are exact opposites.

The reason to distinguish is that if duplicate keys are allowed in a binary
search tree then the enqueue/dequeue/search functions must be aware that
duplicate keys may exist so that those functions will search through the
entirety of the tree in order to put keys in the proper location. We also added
some extra complexity to ensure that keys return in FIFO order when there is
duplication.

I'm leaning toward having the rbtree internally detect duplicates during
enqueue. The other solution I know of is to have the user provide the
insert/find functions, which I have implemented in PR1891. This way the user
will either provide duplicate-aware functions or not. But either way we would
not need this enum.

-- 
Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the bugs mailing list