cpp-common/bt2c: make CStringView convertible from std::string
[babeltrace.git] / src / cpp-common / bt2c / c-string-view.hpp
index c1c8bf389c8bd50233bc56ae54bd602a5aceda5c..fb1b3a658aeb87fab893da56d52c380780f7d25f 100644 (file)
@@ -42,6 +42,15 @@ public:
     {
     }
 
+    /*
+     * Builds a view of the string `str`.
+     *
+     * Intentionally not explicit.
+     */
+    CStringView(const std::string& str) noexcept : _mStr {str.c_str()}
+    {
+    }
+
     /*
      * Makes this view view the C string `str` (may be `nullptr`).
      *
This page took 0.024232 seconds and 4 git commands to generate.