1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2 <html> 3 <head> 4 <title>SWIG and C++17</title> 5 <link rel="stylesheet" type="text/css" href="style.css"> 6 <meta http-equiv="content-type" content="text/html; charset=UTF-8"> 7 </head> 8 9 <body bgcolor="#ffffff"> 10 <H1><a name="CPlusPlus17">9 SWIG and C++17</a></H1> 11 <!-- INDEX --> 12 <div class="sectiontoc"> 13 <ul> 14 <li><a href="#CPlusPlus17_introduction">Introduction</a> 15 <li><a href="#CPlusPlus17_core_language_changes">Core language changes</a> 16 <ul> 17 <li><a href="#CPlusPlus17_nested_namespaces">Nested namespace definitions</a> 18 <li><a href="#CPlusPlus17_u8_char_literals">UTF-8 character literals</a> 19 <li><a href="#CPlusPlus17_hexadecimal_floating_literals">Hexadecimal floating literals</a> 20 </ul> 21 <li><a href="#CPlusPlus17_standard_library_changes">Standard library changes</a> 22 </ul> 23 </div> 24 <!-- INDEX --> 25 26 27 28 <H2><a name="CPlusPlus17_introduction">9.1 Introduction</a></H2> 29 30 31 <p>This chapter gives you a brief overview about the SWIG 32 implementation of the C++17 standard. 33 There isn't much in C++17 that affects SWIG, however, work has only just begun on adding 34 C++17 support. 35 </p> 36 37 <p> 38 <b>Compatibility note:</b> SWIG-4.0.0 is the first version to support any C++17 features. 39 </p> 40 41 <H2><a name="CPlusPlus17_core_language_changes">9.2 Core language changes</a></H2> 42 43 44 <H3><a name="CPlusPlus17_nested_namespaces">9.2.1 Nested namespace definitions</a></H3> 45 46 47 <p> 48 C++17 offers a more concise syntax for defining namespaces. 49 SWIG has support for nested namespace definitions such as: 50 </p> 51 52 <div class="code"> 53 <pre> 54 namespace A::B::C { 55 ... 56 } 57 </pre> 58 </div> 59 60 <p> 61 This is the equivalent to the C++98 namespace definitions: 62 </p> 63 64 <div class="code"> 65 <pre> 66 namespace A { 67 namespace B { 68 namespace C { 69 ... 70 } 71 } 72 } 73 </pre> 74 </div> 75 76 <H3><a name="CPlusPlus17_u8_char_literals">9.2.2 UTF-8 character literals</a></H3> 77 78 79 <p> 80 C++17 added UTF-8 (u8) character literals. 81 These are of type char. 82 Example: 83 </p> 84 85 <div class="code"> 86 <pre> 87 char a = u8'a'; 88 </pre> 89 </div> 90 91 <H3><a name="CPlusPlus17_hexadecimal_floating_literals">9.2.3 Hexadecimal floating literals</a></H3> 92 93 94 <p> 95 C++17 added hexadecimal floating literals. 96 For example: 97 </p> 98 99 <div class="code"> 100 <pre> 101 double f = 0xF.68p2; 102 </pre> 103 </div> 104 105 <H2><a name="CPlusPlus17_standard_library_changes">9.3 Standard library changes</a></H2> 106 107 108 </body> 109 </html>