Difference between revisions of "C++11"

From Inkscape Wiki
Jump to navigation Jump to search
(macOS)
(constexpr)
Line 28: Line 28:
|-
|-
| std::initializer_list || not yet || Easier container initialization/assignation and implicit constructor calls
| std::initializer_list || not yet || Easier container initialization/assignation and implicit constructor calls
|-
| [https://en.cppreference.com/w/cpp/language/constexpr constexpr] || | ? || Additional meanings in C++14/C++17
|-
|-
| toxic feature of doom || style="background: red;" | NO || Never use this (in case we stumble upon C++11 features that we really don't like)
| toxic feature of doom || style="background: red;" | NO || Never use this (in case we stumble upon C++11 features that we really don't like)
|-
| supported feature || style="background: lightgreen;" | from 0.93 ||
|}
|}


Line 61: Line 61:
|-
|-
| range-based for || style="background: lightgreen;" | || || style="background: lightgreen;" | || style="background: lightgreen;" | || style="background: lightgreen;" | || ||
| range-based for || style="background: lightgreen;" | || || style="background: lightgreen;" | || style="background: lightgreen;" | || style="background: lightgreen;" | || ||
|-
| constexpr ||  | || || style="background: lightgreen;" | ||  | ||  | || ||
|}
|}

Revision as of 08:13, 8 June 2019

Usage status

This table lists C++11 features and whether they can be used in Inkscape or not (yet). Add C++11 features that you would like to use to the table, so that we know what to test for to increase the C++11 "allowance".

Feature Can use? Comment
std::unique_ptr<> from 0.93 Replaces boost::scoped_ptr<> and std::auto_ptr<>
std::shared_ptr<> from 0.93 Replaces boost::shared_ptr<>
std::unordered_*<> from 0.93 Replaces the hack in util/unordered-containers.h
auto (type inference) from 0.93
enum class not yet Strong enum constants (take the name of the enum, can't be implicitly converted to int)
range-based for from 0.93 Concise for loops with containers (Python alike)
lambda functions not yet In-place definitions for small functions
constructor delegation not yet Reduces boilerplate when an object has many constructors
right angle brackets in templates not yet Fixes coding style oddity
async, futures not yet Allows easy multithreading
std::initializer_list not yet Easier container initialization/assignation and implicit constructor calls
constexpr ? Additional meanings in C++14/C++17
toxic feature of doom NO Never use this (in case we stumble upon C++11 features that we really don't like)

Platform status

We need to keep coordinated with the section on Distro Dependencies.

Also see these pages:

Note that __cplusplus is always 1 for GCC 4.6 that is used on Windows. So #if __cplusplus < 201103L or variants does not work to choose between C++03 or C++11 code.

The table lists C++11 features and whether they work in trunk on a certain platform as advertised. If all lights are green ⇒ set the light to green in the Usage status section (taking current trunk version into account).

Feature Windows Mac 10.? macOS 10.14, Xcode 10 Fedora 20 Red Hat 7.0 Red Hat 6.5 Comment
TDM-GCC 4.6/4.9 (x64) ? Clang 10 GCC 4.8.2 GCC 4.8.2 GCC 4.4.7
unique_ptr<> Defined in <memory>
shared_ptr<> Defined in <memory>
auto
enum class
range-based for
constexpr