Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-09-07 17:09:48 +0300
committerJacques Lucke <jacques@blender.org>2020-09-07 17:10:01 +0300
commitd71458d91963b56a02bc05d617344fd2871951dd (patch)
tree7fe88b281d3dd359efecb5fa8a40ca83fca92fa2 /source
parent0774fdbeb67dc3acdf90b2dabd920dc9cd1ca521 (diff)
BLI: add comparison operators for StringRef
The semantic of those is the same as for std::string_view.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenlib/BLI_string_ref.hh20
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.
*/