Rename bt2_common::UuidView::string() -> str()
[babeltrace.git] / src / cpp-common / uuid-view.hpp
index 35b0b0624180e2b0654fc6a4bf3c5c2d3c02622e..5c248b616ebf43cc30065c27e2a746163fd4d36e 100644 (file)
@@ -7,7 +7,9 @@
 #ifndef BABELTRACE_CPP_COMMON_UUID_VIEW_HPP
 #define BABELTRACE_CPP_COMMON_UUID_VIEW_HPP
 
+#include <array>
 #include <cstdint>
+#include <string>
 
 #include "common/assert.h"
 #include "common/uuid.h"
@@ -35,17 +37,22 @@ public:
         return !(*this == other);
     }
 
-    std::string string() const
+    bool operator<(const UuidView& other) const noexcept
+    {
+        return bt_uuid_compare(_mUuid, other._mUuid) < 0;
+    }
+
+    std::string str() const
     {
         std::string s;
 
         s.resize(BT_UUID_STR_LEN);
-        bt_uuid_to_str(_mUuid, s.data());
+        bt_uuid_to_str(_mUuid, &s[0]);
 
         return s;
     }
 
-    static std::size_t size() noexcept
+    static constexpr std::size_t size() noexcept
     {
         return BT_UUID_LEN;
     }
This page took 0.030995 seconds and 4 git commands to generate.