[Bf-blender-cvs] [24a77745a44] master: Functions: add utility to create string from value of generic type

Jacques Lucke noreply at git.blender.org
Mon Jul 5 13:04:14 CEST 2021


Commit: 24a77745a44df011b9c2e390e3129b00086b8ea6
Author: Jacques Lucke
Date:   Mon Jul 5 12:59:39 2021 +0200
Branches: master
https://developer.blender.org/rB24a77745a44df011b9c2e390e3129b00086b8ea6

Functions: add utility to create string from value of generic type

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

M	source/blender/functions/FN_cpp_type.hh

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

diff --git a/source/blender/functions/FN_cpp_type.hh b/source/blender/functions/FN_cpp_type.hh
index 4de0533a46d..421e5f0018d 100644
--- a/source/blender/functions/FN_cpp_type.hh
+++ b/source/blender/functions/FN_cpp_type.hh
@@ -545,6 +545,13 @@ class CPPType : NonCopyable, NonMovable {
     m_.print(value, ss);
   }
 
+  std::string to_string(const void *value) const
+  {
+    std::stringstream ss;
+    this->print(value, ss);
+    return ss.str();
+  }
+
   void print_or_default(const void *value, std::stringstream &ss, StringRef default_value) const
   {
     if (this->is_printable()) {



More information about the Bf-blender-cvs mailing list