SWIG and C++17

# 9 SWIG and C++17

- Introduction
- Core language changes
  - Nested namespace definitions
  - UTF-8 character literals
  - Hexadecimal floating literals
  - Fold expressions
- Standard library changes

## 9.1 Introduction

This chapter gives you a brief overview about the SWIG implementation of the C++17 standard. There isn't much in C++17 that affects SWIG, however, work has only just begun on adding C++17 support.

Compatibility note: SWIG-4.0.0 is the first version to support any C++17 features.

## 9.2 Core language changes

### 9.2.1 Nested namespace definitions

C++17 offers a more concise syntax for defining namespaces. SWIG has support for nested namespace definitions such as:

    namespace A::B::C {
      ...
    }

This is the equivalent to the C++98 namespace definitions:

    namespace A {
      namespace B {
        namespace C {
          ...
        }
      }
    }

### 9.2.2 UTF-8 character literals

C++17 added UTF-8 (u8) character literals. These are of type char. Example:

    char a = u8'a';

### 9.2.3 Hexadecimal floating literals

C++17 added hexadecimal floating literals. For example:

    double f = 0xF.68p2;

### 9.2.4 Fold expressions

C++17 added template fold expressions. SWIG 4.3.0 and later support parsing these with a few restrictions. Unary left fold expressions are not supported currently. Also the same restrictions that apply to other expressions apply here too.

## 9.3 Standard library changes