Commit graph

19 commits

Author SHA1 Message Date
William S Fulton
c10a84c775 Cosmetic stray semi-colon removal after %typemap using quotes 2022-08-31 19:40:13 +01:00
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
William S Fulton
a0fed47163 Remove duplicate typemaps 2022-06-30 09:36:29 +01:00
William S Fulton
72ba741d1c Fix wrapping of references/pointers and qualifiers to member pointers
Also fix Go wrapping of member const function pointers.
2017-03-16 21:04:38 +00:00
William S Fulton
bcb7aee022 Merge branch 'master' into gsoc2009-matevz
Conflicts:
	Examples/Makefile.in
	Examples/guile/Makefile.in
	Lib/php/php.swg
	Makefile.in
	Source/CParse/parser.y
	configure.ac
2013-10-10 07:26:09 +01:00
tpapp
054f9dba1a CFFI - Fix missing package before &body - patch #22
Should fix https://github.com/swig/swig/issues/21.
2013-02-09 17:23:16 +00:00
William S Fulton
9bd2fb2cad Add rvalue reference typemaps 2013-01-24 20:27:28 +00:00
William S Fulton
bdb136d611 Change typemap matching rules for the default type (SWIGTYPE) to follow template partial specialization type deduction. Fixes some containers of const pointers. SWIGTYPE*& typemps removed and replaced with SWIGTYPE *const&.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11958 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-04-01 18:26:37 +00:00
William S Fulton
8b42082f88 Apply patch from Petr Viktorin to fix some recent regressions in CFFI/CLOS
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10487 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-05-21 22:15:52 +00:00
William S Fulton
336b50b43d Add the optimal attribute to the out typemap for more optimal code generation when returning objects by value
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10450 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-05-14 22:12:31 +00:00
Surendra Singhi
e33435c4cc aplied patch 1766076
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9898 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-08-15 05:09:02 +00:00
Surendra Singhi
e88aa73dc5 operator overloading support
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9249 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-08-13 13:26:37 +00:00
Surendra Singhi
67f80bb5ef Thanks to Thomas Weidner.
- when feature export is set (export 'foo) is generated for every
symbol, i think should be external.
- when feature inline is set (declaim (inline foo)) is generated
before every function definition
- when feature intern_function is set #.(value-of-intern-function
"name" "nodeType" package) is emitted instead of the plain symbol. a
sample swig-lispify is provided.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9059 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-04-14 10:43:22 +00:00
Surendra Singhi
f1ad6a000d Prefixed package name to cl symbols.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9055 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-04-14 07:54:07 +00:00
Surendra Singhi
70c1bd07a4 Fixes the placement of swig-lisp code, and also makes sure that
literals are properly converted for enums.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8731 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-02-06 20:38:54 +00:00
Surendra Singhi
dafc4dbdfc Frank Buss's fix for anon enums.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8593 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-28 14:07:54 +00:00
Matthias Köppe
4d50698ddf Add #include needed by some SWIG code.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8430 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-14 13:36:48 +00:00
Surendra Singhi
30ba3997a0 Fixed a typo reported by Brad Anderson.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8383 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-12 05:04:22 +00:00
Surendra Singhi
b2cb043998 Initial revision. Adding CFFI module.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8059 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-12-24 14:02:26 +00:00