Difference between revisions of "C++11"
Jump to navigation
Jump to search
(Linked to dependencies page) |
(Improved wiki code; added comments for enum class and range-based for; added request for initializer lists) |
||
Line 1: | Line 1: | ||
== | == 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". | 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". | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! Feature | ! Feature !! Can use? !! Comment | ||
! Can use? | |||
! Comment | |||
|- | |- | ||
| std::unique_ptr<> | | std::unique_ptr<> || not yet || Replaces boost::scoped_ptr<> and std::auto_ptr<> | ||
| not yet | |||
| | |||
|- | |- | ||
| std::shared_ptr<> | | std::shared_ptr<> || not yet || Replaces boost::shared_ptr<> | ||
| not yet | |||
| | |||
|- | |- | ||
| std::unordered_*<> | | std::unordered_*<> || || Replaces the hack in util/unordered-containers.h | ||
| | |||
| | |||
|- | |- | ||
| auto (type inference) | | auto (type inference) || not yet || | ||
| not yet | |||
| | |||
|- | |- | ||
| enum class | | enum class || not yet || Strong enum constants (take the name of the enum, can't be implicitly converted to <code>int</code>) | ||
| not yet | |||
| | |||
|- | |- | ||
| range-based for | | range-based for || not yet || Concise for loops with containers (Python alike) | ||
| not yet | |||
| | |||
|- | |- | ||
| lambda functions | | lambda functions || not yet || In-place definitions for small functions | ||
| not yet | |||
| | |||
|- | |- | ||
| constructor delegation | | constructor delegation || not yet || Reduces boilerplate when an object has many constructors | ||
| not yet | |||
| | |||
|- | |- | ||
| right angle brackets in templates | | right angle brackets in templates || not yet || Fixes coding style oddity | ||
| not yet | |||
| | |||
|- | |- | ||
| async, futures | | async, futures || not yet || Allows easy multithreading | ||
| not yet | |||
| | |||
|- | |- | ||
| | | std::initializer_list || not yet || Easier container initialization/assignation and implicit constructor calls | ||
| | |||
| | |||
|- | |- | ||
| supported feature | | 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) | ||
| style="background: | |- | ||
| | | supported feature || style="background: lightgreen;" | from 0.50 || | ||
|} | |} | ||
== | == Platform status == | ||
We need to keep coordinated with the section on [[Tracking_Dependencies#Distros|Distro Dependencies]] | We need to keep coordinated with the section on [[Tracking_Dependencies#Distros|Distro Dependencies]]. | ||
Also see these pages | Also see these pages: | ||
* http://wiki.apache.org/stdcxx/C++0xCompilerSupport | |||
* http://en.cppreference.com/w/cpp/compiler_support | |||
Note that | Note that <code>__cplusplus</code> is always <code>1</code> for GCC 4.6 that is used on Windows. So <code>#if __cplusplus < 201103L</code> 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 | 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). | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! | ! rowspan="2" | Feature !! Windows !! Mac 10.6 !! Mac 10.7 !! Fedora 20 !! Red Hat 7.0 !! Red Hat 6.5 !! rowspan="2" | Comment | ||
! Windows | |||
! Mac 10.6 | |||
! Mac 10.7 | |||
! Fedora 20 | |||
! Red Hat 7.0 | |||
! Red Hat 6.5 | |||
! Comment | |||
|- | |- | ||
! TDM-GCC 4.6/4.9 (x64) !! GCC 4.2 !! Clang 3(?) !! GCC 4.8.2 !! GCC 4.8.2 !! GCC 4.4.7 | |||
! TDM-GCC 4.6/4.9(x64) | |||
! GCC 4.2 | |||
! Clang 3(?) | |||
! GCC 4.8.2 | |||
! GCC 4.8.2 | |||
! GCC 4.4.7 | |||
|- | |- | ||
| unique_ptr<> | | unique_ptr<> || style="background: lightgreen;" | || || || style="background: lightgreen;" | || style="background: lightgreen;" | || || Defined in <memory> | ||
| style="background: | |||
| | |||
| | |||
| style="background: | |||
| style="background: | |||
| | |||
| Defined in <memory> | |||
|- | |- | ||
| shared_ptr<> | | shared_ptr<> || style="background: lightgreen;" | || || || style="background: lightgreen;" | || style="background: lightgreen;" | || || Defined in <memory> | ||
| style="background: | |||
| | |||
| | |||
| style="background: | |||
| style="background: | |||
| | |||
| Defined in <memory> | |||
|- | |- | ||
| auto | | auto || style="background: lightgreen;" | || || || style="background: lightgreen;" | || style="background: lightgreen;" | || || | ||
| style="background: | |||
| | |||
| | |||
| style="background: | |||
| style="background: | |||
| | |||
| | |||
|- | |- | ||
| enum class | | enum class || style="background: lightgreen;" | || || || style="background: lightgreen;" | || style="background: lightgreen;" | || || | ||
| style="background: | |||
| | |||
| | |||
| style="background: | |||
| style="background: | |||
| | |||
| | |||
|- | |- | ||
| range-based for | | range-based for || style="background: lightgreen;" | || || || style="background: lightgreen;" | || style="background: lightgreen;" | || || | ||
| style="background: | |||
| | |||
| | |||
| style="background: | |||
| style="background: | |||
| | |||
| | |||
|} | |} |
Revision as of 07:06, 10 July 2016
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<> | not yet | Replaces boost::scoped_ptr<> and std::auto_ptr<> |
std::shared_ptr<> | not yet | Replaces boost::shared_ptr<> |
std::unordered_*<> | Replaces the hack in util/unordered-containers.h | |
auto (type inference) | not yet | |
enum class | not yet | Strong enum constants (take the name of the enum, can't be implicitly converted to int )
|
range-based for | not yet | 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 |
toxic feature of doom | NO | Never use this (in case we stumble upon C++11 features that we really don't like) |
supported feature | from 0.50 |
Platform status
We need to keep coordinated with the section on Distro Dependencies.
Also see these pages:
- http://wiki.apache.org/stdcxx/C++0xCompilerSupport
- http://en.cppreference.com/w/cpp/compiler_support
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.6 | Mac 10.7 | Fedora 20 | Red Hat 7.0 | Red Hat 6.5 | Comment |
---|---|---|---|---|---|---|---|
TDM-GCC 4.6/4.9 (x64) | GCC 4.2 | Clang 3(?) | 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 |