Blender Git Loki
Git Commits -> Revision 6c2e1f3
Revision 6c2e1f3 by Jacques Lucke (master) February 20, 2021, 21:05 (GMT) |
BLI: cleanup StringRef and Span and improve parameter validation Previously, methods like `Span.drop_front` would crash when more elements would be dropped than are available. While this is most efficient, it is not very practical in some use cases. Also other languages silently clamp the index, so one can easily write wrong code accidentally. Now, `Span.drop_front` and similar methods will only crash when n is negative. Too large values will be clamped down to their maximum possible value. While this is slightly less efficient, I did not have a case where this actually mattered yet. If it does matter in the future, we can add a separate `*_unchecked` method. This should not change the behavior of existing code. |
Commit Details:
Full Hash: 6c2e1f33983766ee5ee028e14a24e36c28d0a566
Parent Commit: d8b4246
Lines Changed: +119, -49