Commit: d71458d91963b56a02bc05d617344fd2871951dd
Author: Jacques Lucke
Date:   Mon Sep 7 16:09:48 2020 +0200
Branches: master
https://developer.blender.org/rBd71458d91963b56a02bc05d617344fd2871951dd

BLI: add comparison operators for StringRef

The semantic of those is the same as for std::string_view.

===================================================================

M       source/blender/blenlib/BLI_string_ref.hh

===================================================================

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.
  */

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to