summaryrefslogtreecommitdiff
path: root/Lib/csharp
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2022-07-17 20:44:20 +0100
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2022-07-17 20:44:20 +0100
commit5dd5e80a84a9c7b0941f55e21c8ac53c7529f5fd (patch)
treece9eced3ad4f0bf80ad25f74da468fa4c6f9e1ff /Lib/csharp
parent50fc600e8cb128e8e1d4be3d07107b9f8df5edc2 (diff)
downloadswig-5dd5e80a84a9c7b0941f55e21c8ac53c7529f5fd.tar.gz
Cosmetic formatting and doc updates in std_unique_ptr.i files
Diffstat (limited to 'Lib/csharp')
-rw-r--r--Lib/csharp/std_unique_ptr.i23
1 files changed, 13 insertions, 10 deletions
diff --git a/Lib/csharp/std_unique_ptr.i b/Lib/csharp/std_unique_ptr.i
index ba13fce4e..2233cdc06 100644
--- a/Lib/csharp/std_unique_ptr.i
+++ b/Lib/csharp/std_unique_ptr.i
@@ -1,10 +1,11 @@
/* -----------------------------------------------------------------------------
* std_unique_ptr.i
*
- * The typemaps here allow handling functions returning std::unique_ptr<>,
- * which is the most common use of this type. If you have functions taking it
- * as parameter, these typemaps can't be used for them and you need to do
- * something else (e.g. use shared_ptr<> which SWIG supports fully).
+ * SWIG library file for handling std::unique_ptr.
+ * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy
+ * class when returning a std::unique_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::unique_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
* ----------------------------------------------------------------------------- */
%define %unique_ptr(TYPE)
@@ -18,16 +19,18 @@
%typemap(csin) std::unique_ptr< TYPE > "$typemap(cstype, TYPE).swigRelease($csinput)"
%typemap (out) std::unique_ptr< TYPE > %{
- $result = (void *)$1.release();
+ $result = (void *)$1.release();
%}
+
%typemap(csout, excode=SWIGEXCODE) std::unique_ptr< TYPE > {
- System.IntPtr cPtr = $imcall;
- $typemap(cstype, TYPE) ret = (cPtr == System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
- return ret;
- }
+ System.IntPtr cPtr = $imcall;
+ $typemap(cstype, TYPE) ret = (cPtr == System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
+ return ret;
+ }
+
%template() std::unique_ptr< TYPE >;
%enddef
namespace std {
template <class T> class unique_ptr {};
-}
+}