Difference between revisions of "C++20"
Jump to navigation
Jump to search
m (Add consteval static as an entry) |
(Update for Ubuntu 24.04) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 31: | Line 31: | ||
|- | |- | ||
| Heterogenous lookup in <code>std::unordered_map</code> | | Heterogenous lookup in <code>std::unordered_map</code> | ||
|| C++20 || style="background: pink;" | not yet || || || Faster lookup, use of smart pointers as keys. | || C++20 || style="background: pink;" | not yet || || || Faster lookup, use of smart pointers as keys. | ||
|- | |||
|<code>consteval static</code> member functions | |<code>consteval static</code> member functions | ||
|C++20 | |C++20 | ||
| style="background: pink;" |not yet | | style="background: pink;" | not yet | ||
| | | | ||
| | | | ||
Line 44: | Line 43: | ||
References: | References: | ||
*General: https://en.cppreference.com/w/Template:cpp/compiler_support/20 | * General: https://en.cppreference.com/w/Template:cpp/compiler_support/20 | ||
* Apple Clang: https://developer.apple.com/documentation/xcode-release-notes | * Apple Clang: https://developer.apple.com/documentation/xcode-release-notes | ||
As of | As of 10 July 2024, the CI runners for the various supported platforms are | ||
*Linux: | * Linux: | ||
**appimage:linux: GNU 13.2.0 (building on Ubuntu | ** appimage:linux: GNU 13.2.0 (building on Ubuntu 24.04) | ||
**inkscape:linux: Same as above | ** inkscape:linux: Same as above | ||
*Windows | * Windows | ||
**inkscape:windows:build: GNU 13.2.0 | ** inkscape:windows:build: GNU 13.2.0 | ||
** inkscape:windows:dist: Same as above | ** inkscape:windows:dist: Same as above | ||
*macOS: | * macOS: | ||
**inkscape::macos:arm: Apple Clang 15.0.0 | ** inkscape::macos:arm: Apple Clang 15.0.0 | ||
**inkscape:macos:x64: Apple Clang 13.0.0 (temporarily disabled since GTK4 port) | ** inkscape:macos:x64: Apple Clang 13.0.0 (temporarily disabled since GTK4 port) | ||
We strive to support latest Debian stable and latest Ubuntu LTS. | We strive to support latest Debian stable and latest Ubuntu LTS. | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! Distro|| gcc|| clang||gtkmm4 | ! Distro || gcc || clang || glib || glibmm || gtk4 || gtkmm4 || Can build? | ||
|- | |- | ||
|Debian 12 (Bookworm, stable)||12.2.0||15.0.6||4.8.3 | | Debian 12 (Bookworm, stable) || 12.2.0 || 15.0.6 || style="background: pink;" | 2.74.6 || style="background: pink;" | 2.74.0 || style="background: wheat;" | 4.8.3 || style="background: wheat;" | 4.8.3 || ❌ | ||
|- | |- | ||
|Ubuntu | | Ubuntu 24.04 (Noble) || 13.2.0 || 18.1.3 || 2.80.0 || 2.78.1 || 4.14.2 || style="background: wheat;" | 4.10.1 || ✅ | ||
| | |||
| | |||
|} | |} | ||
The build requires glibmm >= 2.78.1 and gtkmm4 >= 4.14. The build system will supply its own gtkmm4 if out-of-date. Therefore the build only currently works out of the box on Ubuntu 24.04. | |||
Deprecated items that we still use: | Deprecated items that we still use: | ||
*warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated] https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0806r2.html | * warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated] https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0806r2.html | ||
*warning: bitwise operation between different enumeration types ‘Box3D::Axis’ and ‘Box3D::FrontOrRear’ is deprecated [-Wdeprecated-enum-enum-conversion] | * warning: bitwise operation between different enumeration types ‘Box3D::Axis’ and ‘Box3D::FrontOrRear’ is deprecated [-Wdeprecated-enum-enum-conversion] |
Latest revision as of 00:50, 10 July 2024
Some things that will be interesting to use once C++20 is common:
Feature | Since | Can use? | GCC | Apple Clang | Comment |
---|---|---|---|---|---|
std::span |
C++20 | from 1.4 | 10 | 11.0.3 | Handle buffers like standard library containers without risk of overflow. |
std::format |
C++20 | not yet | 13 | 15.3 | Better and more efficient formatting of strings. Text Formatting |
std::lerp |
C++20 | from 1.4 | 9 | 11.0.3 | Linear interpolation. (ui/tools/pencil-tool.cpp) |
std::bit_floor |
C++20 | from 1.4 | 9/10 | 11.0.3/13.0.0 | Compute floor(log2(x)) . (helper/mathfns.h)
|
Concepts | C++20 | from 1.4? | 6/10 | 12.0.0 Partial | Safer templating. (ui/controller.h) |
Coroutines | C++20 | not yet | 10 | 10.0.1 Partial, 15.3 Full |
Simpler asynchronous code. (trace/trace.cpp) |
std::make_unique_for_overwrite
|
C++20 | not yet | 11 | 15.0.0 | Don't zero arrays allocated using std::make_unique. (util/pool.cpp) |
Ranges | C++20 | not yet | ? | (ui/dialog/swatches.cpp) | |
Structural templates | C++20 | from 1.4? | Partial | Allow instances of arbitrary literal classes as template parameters. (display/drawing.cpp) | |
Mathematical Constants | C++20 | 10 | 12.0.5 | Constants like std::numbers::pi .
| |
Heterogenous lookup in std::unordered_map
|
C++20 | not yet | Faster lookup, use of smart pointers as keys. | ||
consteval static member functions
|
C++20 | not yet | Guaranteed compile time evaluation of member functions (stronger than constexpr )
|
References:
- General: https://en.cppreference.com/w/Template:cpp/compiler_support/20
- Apple Clang: https://developer.apple.com/documentation/xcode-release-notes
As of 10 July 2024, the CI runners for the various supported platforms are
- Linux:
- appimage:linux: GNU 13.2.0 (building on Ubuntu 24.04)
- inkscape:linux: Same as above
- Windows
- inkscape:windows:build: GNU 13.2.0
- inkscape:windows:dist: Same as above
- macOS:
- inkscape::macos:arm: Apple Clang 15.0.0
- inkscape:macos:x64: Apple Clang 13.0.0 (temporarily disabled since GTK4 port)
We strive to support latest Debian stable and latest Ubuntu LTS.
Distro | gcc | clang | glib | glibmm | gtk4 | gtkmm4 | Can build? |
---|---|---|---|---|---|---|---|
Debian 12 (Bookworm, stable) | 12.2.0 | 15.0.6 | 2.74.6 | 2.74.0 | 4.8.3 | 4.8.3 | ❌ |
Ubuntu 24.04 (Noble) | 13.2.0 | 18.1.3 | 2.80.0 | 2.78.1 | 4.14.2 | 4.10.1 | ✅ |
The build requires glibmm >= 2.78.1 and gtkmm4 >= 4.14. The build system will supply its own gtkmm4 if out-of-date. Therefore the build only currently works out of the box on Ubuntu 24.04.
Deprecated items that we still use:
- warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated] https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0806r2.html
- warning: bitwise operation between different enumeration types ‘Box3D::Axis’ and ‘Box3D::FrontOrRear’ is deprecated [-Wdeprecated-enum-enum-conversion]