blob: a289d776f2060e0ca53fe5404c52e523ec932c70 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<title>SWIG and C++20</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<body bgcolor="#ffffff">
<H1><a name="CPlusPlus20">10 SWIG and C++20</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<li><a href="#CPlusPlus20_introduction">Introduction</a>
<li><a href="#CPlusPlus20_core_language_changes">Core language changes</a>
<li><a href="#CPlusPlus20_spaceship_operator">Spaceship operator</a>
<li><a href="#CPlusPlus20_lambda_templates">Lambda templates</a>
<li><a href="#CPlusPlus20_standard_library_changes">Standard library changes</a>
<!-- INDEX -->
<H2><a name="CPlusPlus20_introduction">10.1 Introduction</a></H2>
<p>This chapter gives you a brief overview about the SWIG
implementation of the C++20 standard.
Work has only just begun on adding C++20 support.
<b>Compatibility note:</b> SWIG-4.1.0 is the first version to support any C++20 features.
<H2><a name="CPlusPlus20_core_language_changes">10.2 Core language changes</a></H2>
<H3><a name="CPlusPlus20_spaceship_operator">10.2.1 Spaceship operator</a></H3>
SWIG supports the spaceship operator <tt>&lt;=&gt;</tt> in constant
expressions. To simplify handling of the return value type, it is currently
treated as an integer rather than <tt>std::strong_ordering</tt>, etc.
In practice we think that should do the right thing in most cases.
SWIG also recognises <tt>operator&lt;=&gt;</tt> which can be wrapped
if renamed. There is not currently any default renaming for the operator
or any attempt to automatically map it to a three-way comparison operator
in any of the target languages.
<H3><a name="CPlusPlus20_lambda_templates">10.2.2 Lambda templates</a></H3>
SWIG should parse lambda templates, but like
<a href="CPlusPlus11.html#CPlusPlus11_lambda_functions_and_expressions">
non-templated lambdas</a> they aren't currently wrapped.
<H2><a name="CPlusPlus20_standard_library_changes">10.3 Standard library changes</a></H2>