You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently cpp-sort provides no specific guarantee about its sorting algorithms when an exception is thrown except the no-leak guarantee (all the memory allocated by the sorting algorithms is freed when an exception occurs).
While making every algorithm noexcept is impossible, it should still be possible to improve the library with regard to exception safety:
Analyze and document the current guarantees
Check whether simple algorithms can be conditionally noexcept (it may depend on too many things)
When values are moved from a collection and back into it, check whether it is possible to make some algorithms put the extracted values back into the collection, albeit in an unspecified order
No matter what is or isn't done, we need to be more specific in the documentation.
The text was updated successfully, but these errors were encountered:
Making algorithms conditionally noexcept seems difficult. When an algorithm doesn't throw std::bad_alloc, the following operations might still throw:
The comparison function
The projection function
Operations on iterators
Move & swap operations
While it might be possible to provide better guarantees when the comparison or projection functions throw, I'm not sure that it is worth it. Recovering when a move or swap throw seems impossible. I guess that I will merely document what can happen with algorithms and let it be.
Currently cpp-sort provides no specific guarantee about its sorting algorithms when an exception is thrown except the no-leak guarantee (all the memory allocated by the sorting algorithms is freed when an exception occurs).
While making every algorithm
noexcept
is impossible, it should still be possible to improve the library with regard to exception safety:noexcept
(it may depend on too many things)No matter what is or isn't done, we need to be more specific in the documentation.
The text was updated successfully, but these errors were encountered: