[glibmm] Add Glib::ustring::release()



commit a723f702c2feb92256ff10e6a56326063d4a062e
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Sun Aug 21 10:57:26 2022 +0200

    Add Glib::ustring::release()
    
    Fixes #101

 glib/glibmm/ustring.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/glib/glibmm/ustring.h b/glib/glibmm/ustring.h
index 41165f58..3d879be9 100644
--- a/glib/glibmm/ustring.h
+++ b/glib/glibmm/ustring.h
@@ -22,6 +22,7 @@
 #include <glib.h>
 
 #include <cstddef> // for std::size_t and optionally std::ptrdiff_t
+#include <utility> // For std::move()
 #include <initializer_list>
 #include <iosfwd>
 #include <iterator>
@@ -677,6 +678,10 @@ public:
 
   GLIBMM_API inline operator std::string() const; // e.g. std::string str = ustring();
   GLIBMM_API inline const std::string& raw() const;
+  /*! Return the stored string, moved from the %ustring.
+   * @newin{2,74}
+   */
+  GLIBMM_API inline std::string release();
 
   // Not necessarily an ASCII char*. Use g_utf8_*() where necessary.
   GLIBMM_API const char* data() const;
@@ -1259,6 +1264,12 @@ ustring::raw() const
   return string_;
 }
 
+inline std::string
+ustring::release()
+{
+  return std::move(string_);
+}
+
 template <class... Ts>
 inline // static
   ustring


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]