6.20.5 Sets

There is also a dedicated Set_T datastructure which is a bit more efficient (not storing an unneeded bool) and allows more precise methods (especially when it comes to sorted sets). The Set_T API attempts to respect the principle of reversibility, which states that a method that mutates the data structure should ideally return precisely the amount of information needed to reverse the modification. For instance, a method that removes an element should return that element — unless the element is already known to the caller (e.g., passed as an argument), in which case it suffices to return a boolean to indicate whether the removal was successful. (By contrast, the Map_K_V API follows the principle that a method should either return something or mutate the datastructure, but not both.)