swig/Lib/typemaps
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
..
attribute.swg Move %attribute documentation into the manual 2022-01-26 09:18:55 -06:00
carrays.swg Fix constructors in named typedef class declarations 2011-08-25 19:27:38 +00:00
cdata.swg SWIG license change - The Examples and Lib move to a very permissive license in the LICENSE file, removing the BSD license restrictions as agreed by committers since it was inadvertently introduced. Remove some examples where the impact of the license change is not clear. 2010-02-27 23:26:02 +00:00
cmalloc.swg SWIG license change - The Examples and Lib move to a very permissive license in the LICENSE file, removing the BSD license restrictions as agreed by committers since it was inadvertently introduced. Remove some examples where the impact of the license change is not clear. 2010-02-27 23:26:02 +00:00
cpointer.swg Fix function prototypes of generated pointer functions 2022-02-03 17:25:44 +13:00
cstring.swg Perl added to the Unified typemap library, cleaner way to use the library, and 'normalized' macro names 2005-10-24 14:59:05 +00:00
cstrings.swg cstrings.swg: fix function names inside comments (#790) 2016-09-16 12:26:35 +12:00
cwstring.swg Perl added to the Unified typemap library, cleaner way to use the library, and 'normalized' macro names 2005-10-24 14:59:05 +00:00
enumint.swg Add rvalue reference typemaps 2013-01-24 20:27:29 +00:00
exception.swg Avoid -Wempty-body warnings from SWIG_contract_assert 2022-02-11 18:39:08 +13:00
factory.swg add note for namespace issues 2006-03-07 09:15:31 +00:00
fragments.swg Remove redundant conditional 2022-03-07 09:11:50 +13:00
implicit.swg UTL STL container descriptor checks 2016-07-28 22:51:29 +01:00
inoutlist.swg Fix a few more typos in comments 2006-09-28 06:39:07 +00:00
misctypes.swg last performance improvements, and typemaps fixes 2005-11-24 09:20:24 +00:00
primtypes.swg Add support for ptrdiff_t and size_t == long long 2016-01-06 16:52:37 -05:00
ptrtypes.swg Correct special variables in 'directorargout' typemap. This change will break any 'directorargout' typemaps you may have written. Please change: to and to \n Also fix the named 'directorargout' DIRECTOROUT typemaps for these languages which didn't previously compile and add in , etc expansion.\n [C#, Go, Java, D] Add support for the 'directorargout' typemap.\n [Java] Add (char *STRING, size_t LENGTH) director typemaps. 2011-12-20 20:50:36 +00:00
README Fix a few more typos in comments 2006-09-28 06:39:07 +00:00
std_except.swg Fix missed files 2016-09-17 19:01:42 +02:00
std_string.swg Add <string> fragment 2014-02-15 23:30:14 +00:00
std_strings.swg Remove pointless special casing of zero-length strings, remnant of a series 2011-02-18 08:44:44 +00:00
std_wstring.swg Add <string> fragment 2014-02-15 23:30:14 +00:00
string.swg Correct warning message for wchar_t * typemaps 2022-05-06 18:44:02 +01:00
strings.swg Correct warning message for wchar_t * typemaps 2022-05-06 18:44:02 +01:00
swigmacros.swg Remove -cppcast and -nocppcast command line options 2018-11-13 07:36:09 +00:00
swigobject.swg The 'directorin' typemap now accepts , etc expansions instead of having to use workarounds - _name, _name etc. 2011-12-21 07:16:44 +00:00
swigtype.swg Movable and move-only types supported in "out" typemaps. 2022-06-30 17:26:48 +01:00
swigtypemaps.swg Fix a few typos in comments and docs 2013-12-12 11:45:30 +13:00
typemaps.swg SWIG license change - The Examples and Lib move to a very permissive license in the LICENSE file, removing the BSD license restrictions as agreed by committers since it was inadvertently introduced. Remove some examples where the impact of the license change is not clear. 2010-02-27 23:26:02 +00:00
valtypes.swg The 'directorin' typemap now accepts , etc expansions instead of having to use workarounds - _name, _name etc. 2011-12-21 07:16:44 +00:00
void.swg The 'directorin' typemap now accepts , etc expansions instead of having to use workarounds - _name, _name etc. 2011-12-21 07:16:44 +00:00
wstring.swg Correct warning message for wchar_t * typemaps 2022-05-06 18:44:02 +01:00

Still in development, but if you are interested into looking around,
start with


     swigtypemaps.swg

which is the head file. Also read the docs for %fragments in 

     fragments.swg 

and follow the definitions in one of the supported languages:

     python, perl, ruby, tcl




/* -----------------------------------------------------------------------------
 *  Internal typemap specializations
 * ----------------------------------------------------------------------------- */


carrays.swg		Implement the carrays.i library
cdata.swg		Implement the cdata.i library
cmalloc.swg		Implement the cmalloc.i library
cpointer.swg		Implement the cpointer.i library
cstring.swg		Implement the cstring.i library typemaps for char *
cwstring.swg		Implement the cstring.i library typemaps for wchar_t *
exception.swg		Implement the exception.i library
implicit.swg		Allow the use of implicit C++ constructors

string.swg		Typemaps for char * string
wstring.swg		Typemaps for wchar_t * string
std_string.swg		Typemaps for std::string
std_wstring.swg		Typemaps for std::wstring
swigtype.swg		Typemaps for the SWIGTYPE type
void.swg		Typemaps for the 'void' type
enumint.swg		Typemaps for enums treated as 'int' 
swigobject.swg		Typemaps for the SWIG_Object as in PyObject, Tcl_Obj, etc.
misctypes.swg		Typemaps for miscellaneos types (size_t, ptrdiff_t, etc)
ptrtypes.swg		Typemaps for types with a 'ptr' behavior
valtypes.swg		Typemaps for 'by value' types
inoutlist.swg		IN/OUTPUT/INOUT typemaps, where the OUTPUT values are returned in a list
primtypes.swg		Common macros to manage primitive types (short,int,double,etc)

cstrings.swg		Common macros to implemented the cstring/cwstring libraries
std_strings.swg		Common macros to implemented the std::string/std::wstring typemaps
strings.swg		Common macros and typemaps for string and wstring (char *, wchar_t *)

swigmacros.swg		Basic macros 
fragments.swg		Macros for fragment manipulations


typemaps.swg		The old typemaps.i library, not needed anymore