2 ms·
Here is the documentation that you consider unclear >If the container is not empty, the function never throws exceptions (no-throw guarantee). Otherwise, it ca
by imtringued 4y ago
Here is the documentation that you consider unclear
>If the container is not empty, the function never throws exceptions (no-throw guarantee).
Otherwise, it causes undefined behavior.
ChatGPT failed at basic regurgitation.
- tialaramex 4y agoThis is, at best, clumsily worded, because it requires that the reader hold two negatives simultaneously. "If the container is not empty, the function never throws" How about this: If the container is empty the function causes undefined behaviour. Otherwise it never throws exceptions (no-throw guarantee). We avoided having to hold two negatives, and we also put the thing you need to care about up front where it's more likely to be noticed.
- chipsa 4y agoThe function never throws, whether empty or not. So, skip the "otherwise".
- tialaramex 4y agoIt's not called "Undefined except we promise it can't possibly throw" behaviour.