]> Creatis software - gdcm.git/blobdiff - gdcmPython/gdcm.i
* gdcmPython/gdcm.i : bug fix. Now string are correctly converted in python
[gdcm.git] / gdcmPython / gdcm.i
index 4148b71780c776559625cad09051f209916b430d..399f6f4fbcfaf4da12cf156d3195bf2afac34965 100644 (file)
@@ -281,11 +281,21 @@ typedef unsigned long long uint64_t;
 
 ////////////////////  STL string versus Python str  ////////////////////////
 // Convertion returning a C++ string.
-%typemap(out) string, std::string 
+%typemap(out) std::string
 {
     $result = PyString_FromString(($1).c_str());
 }
 
+%typemap(out) string
+{
+    $result = PyString_FromString(($1).c_str());
+}
+
+%typemap(out) std::string const &
+{
+    $result = PyString_FromString(($1)->c_str());
+}
+
 // Convertion of incoming Python str to STL string
 %typemap(python, in) const std::string, std::string
 {