swig/Lib/csharp
William S Fulton bf36bf7d8a Movable and move-only types supported in "out" typemaps.
Enhance SWIGTYPE "out" typemaps to use std::move when copying
objects, thereby making use of move semantics when wrapping a function returning
by value if the returned type supports move semantics.

Wrapping functions that return move only types 'by value' now work out the box
without having to provide custom typemaps.

The implementation removed all casts in the "out" typemaps to allow the compiler to
appropriately choose calling a move constructor, where possible, otherwise a copy
constructor. The implementation alsoand required modifying SwigValueWrapper to
change a cast operator from:

  SwigValueWrapper::operator T&() const;

to

  #if __cplusplus >=201103L
    SwigValueWrapper::operator T&&() const;
  #else
    SwigValueWrapper::operator T&() const;
  #endif

This is not backwards compatible for C++11 and later when using the valuewrapper feature
if a cast is explicitly being made in user supplied "out" typemaps. Suggested change
in custom "out" typemaps for C++11 and later code:

1. Try remove the cast altogether to let the compiler use an appropriate implicit cast.
2. Change the cast, for example, from static_cast<X &> to static_cast<X &&>, using the
   __cplusplus macro if all versions of C++ need to be supported.

Issue #999
Closes #1044

More about the commit:
Added some missing "varout" typemaps for Ocaml which was falling back to
use "out" typemaps as they were missing.

Ruby std::set fix for SwigValueWrapper C++11 changes.
2022-06-30 17:26:48 +01:00
..
arrays_csharp.i Change C# bool[] typemaps to marshall as 1-byte 2019-07-06 12:56:27 +01:00
boost_intrusive_ptr.i Fix C# CA1063 warning by implementing the recommended Dispose methods. 2019-04-08 19:20:45 +01:00
boost_shared_ptr.i Fix C# CA1063 warning by implementing the recommended Dispose methods. 2019-04-08 19:20:45 +01:00
complex.i Add std_complex.i for C# too 2017-04-14 19:23:31 +02:00
csharp.swg Movable and move-only types supported in "out" typemaps. 2022-06-30 17:26:48 +01:00
csharphead.swg Avoid -Wempty-body warnings from SWIG_contract_assert 2022-02-11 18:39:08 +13:00
csharpkw.swg Renames performed by %namewarn with rename= are printed in warning message 2022-02-06 13:51:37 -05:00
director.swg Add raise methods for throwing c++ exceptions in C#, Java, D 2017-05-13 17:01:15 +01:00
enums.swg C++11 strongly typed enum fixes for directors 2015-01-15 19:48:07 +00:00
enumsimple.swg C++11 strongly typed enum fixes for directors 2015-01-15 19:48:07 +00:00
enumtypesafe.swg C++11 strongly typed enum fixes for directors 2015-01-15 19:48:07 +00:00
std_array.i Improve backwards compatibility in C#/Java std::array wrappers 2019-04-19 11:06:24 +01:00
std_auto_ptr.i Fix more "allows to" and other typos 2021-04-21 15:54:46 +12:00
std_common.i const size_t& typemaps added 2006-10-17 21:43:40 +00:00
std_complex.i Precision loss warning fixes for C# std::complex<float> typemaps 2017-10-10 19:26:54 +01:00
std_deque.i Each target language now has its own std_deque.i like the other STL wrappers. 2006-01-08 20:08:44 +00:00
std_except.i Add <typeinfo> header for std::bad_cast 2016-09-17 13:24:32 +02:00
std_list.i Replace void* with iterator* in C# std::list wrappers 2019-03-25 08:02:32 +00:00
std_map.i Add STL container copy constructors where missing 2019-02-14 18:53:05 +00:00
std_pair.i Consistent parameter names for std::pair 2019-02-14 22:44:27 +00:00
std_set.i Allow std::set<> C# typemaps to work for non-nullable types too 2019-07-11 13:09:46 +02:00
std_shared_ptr.i Add std_shared_ptr.i and document shared_ptr library 2010-06-01 19:03:55 +00:00
std_string.i More director const std::string& testing and C# leak fix 2022-02-13 23:00:04 +00:00
std_vector.i Fix CS0034 in Capacity method of std::vector 2022-03-18 08:01:37 +01:00
std_wstring.i C# std::wstring director support 2022-05-04 21:37:47 +01:00
stl.i Create a consistent stl.i library file 2019-02-12 18:46:05 +00:00
swiginterface.i Fix directorin SWIGTYPE typemaps to make a copy as these are used for pass by value. 2016-05-14 21:32:24 +01:00
swigtype_inout.i Add new swigtype_inout.i library containing SWIGTYPE *& OUTPUT typemaps. 2014-02-04 06:54:22 +00:00
typemaps.i Remove using directives from the generated C# code and fully qualify the use of all .NET framework types in order to minimize potential name collisions from input files defining types, namespace, etc with the same name as .NET framework members. 2013-10-17 15:44:24 -05:00
wchar.i Add C# wchar_t * director typemaps 2022-05-04 21:37:47 +01:00