diff options
author | Jacques Lucke <jacques@blender.org> | 2020-09-07 17:09:48 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-09-07 17:10:01 +0300 |
commit | d71458d91963b56a02bc05d617344fd2871951dd (patch) | |
tree | 7fe88b281d3dd359efecb5fa8a40ca83fca92fa2 /source/blender/blenlib/BLI_string_ref.hh | |
parent | 0774fdbeb67dc3acdf90b2dabd920dc9cd1ca521 (diff) |
BLI: add comparison operators for StringRef
The semantic of those is the same as for std::string_view.
Diffstat (limited to 'source/blender/blenlib/BLI_string_ref.hh')
-rw-r--r-- | source/blender/blenlib/BLI_string_ref.hh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_string_ref.hh b/source/blender/blenlib/BLI_string_ref.hh index be18848fbf4..8e3e3be99e2 100644 --- a/source/blender/blenlib/BLI_string_ref.hh +++ b/source/blender/blenlib/BLI_string_ref.hh @@ -404,6 +404,26 @@ inline bool operator!=(StringRef a, StringRef b) return !(a == b); } +inline bool operator<(StringRef a, StringRef b) +{ + return std::string_view(a) < std::string_view(b); +} + +inline bool operator>(StringRef a, StringRef b) +{ + return std::string_view(a) > std::string_view(b); +} + +inline bool operator<=(StringRef a, StringRef b) +{ + return std::string_view(a) <= std::string_view(b); +} + +inline bool operator>=(StringRef a, StringRef b) +{ + return std::string_view(a) >= std::string_view(b); +} + /** * Return true when the string starts with the given prefix. */ |