AMDG On 11/23/2013 10:20 AM, Nathaniel McClatchey wrote:
I've recently made a double-ended priority queue (priority deque) publicly available at https://github.com/nmcclatchey/Priority-Deque , with the intent of submitting it to Boost (more specifically, I wish to make it part of Boost.Container). I would appreciate any comments, discussion, or refinements.
- Please consider (and document) the exception safety guarantees that you provide. From a brief glance at the code, I suspect that merge and push, at least can leave an invalid heap if they throw. - You're going to need a lot more tests. In particular, you need to check that pushing and popping values gives the correct results, not just that the priority_deque's invariants hold.
<snip>
A specific question for anyone more experienced with development of generalized code: * I added several functions for controlled access to arbitrary elements. Is this overkill? If so, should they be removed?
I assume that you're referring to begin_mutable, end_mutable, and make_valid? What I'd actually prefer to see is for this to be implemented as algorithms akin to std::push_heap and std::pop_heap. That way priority_deque is just a thin wrapper, and those who need more functionality can easily build their own. In Christ, Steven Watanabe