Krita/C++11: Difference between revisions
Miabrahams (talk | contribs) |
Miabrahams (talk | contribs) Add list of features for consideration |
||
Line 10: | Line 10: | ||
* [https://archive.fosdem.org/2013/schedule/event/introcplusplus11/attachments/slides/203/export/events/attachments/introcplusplus11/slides/203/fosdem2013_cpp11.pdf FOSDEM 2013 presentation slides] | * [https://archive.fosdem.org/2013/schedule/event/introcplusplus11/attachments/slides/203/export/events/attachments/introcplusplus11/slides/203/fosdem2013_cpp11.pdf FOSDEM 2013 presentation slides] | ||
* [https://www.kdab.com/wp-content/uploads/stories/slides/DD12/mutz-dd-speed-up-your-qt-5-programs-using-c++11.pdf KDAB: speed up your Qt 5 programs using C++11] | * [https://www.kdab.com/wp-content/uploads/stories/slides/DD12/mutz-dd-speed-up-your-qt-5-programs-using-c++11.pdf KDAB: speed up your Qt 5 programs using C++11] | ||
* [http://www.stroustrup.com/C++11FAQ.html Bjarne Stroustrup's C++11 FAQ] - the grand daddy | |||
= Particular Features = | = Particular Features = | ||
=== Type Inference (auto) === | |||
'''Motivation:''' | |||
'''Drawbacks:''' | |||
'''Recommendation:''' | |||
=== Range-based for loop === | |||
'''Motivation:''' | |||
'''Drawbacks:''' | |||
'''Recommendation:''' | |||
=== Universal and General Initialization === | |||
'''Motivation:''' | |||
Member Initializers | |||
Mixed uniform initialization | |||
'''Drawbacks:''' | |||
'''Recommendation:''' | |||
=== Lambda === | |||
'''Motivation:''' | |||
Lambda expressions for slots | |||
'''Drawbacks:''' | |||
'''Recommendation:''' | |||
=== constexpr === | |||
'''Motivation:''' | |||
'''Drawbacks:''' | |||
'''Recommendation:''' | |||
=== Override and final === | |||
'''Motivation:''' | |||
'''Drawbacks:''' | |||
'''Recommendation:''' | |||
=== <algorithm> === | |||
'''Motivation:''' | |||
'''Drawbacks:''' | |||
'''Recommendation:''' | |||
=== nullptr === | |||
'''Motivation:''' | |||
'''Drawbacks:''' | |||
'''Recommendation:''' | |||
=== Deleted and default class members === | |||
'''Motivation:''' | |||
'''Drawbacks:''' | |||
'''Recommendation:''' | |||
=== unique_ptr === | |||
'''Motivation:''' | |||
'''Drawbacks:''' unique_ptr is unable to be copied, and therefore cannot be used inside Qt classes. For example QVector<std::unique_ptr> is invalid, because QVector requires its members can be copied. This makes converting to unique_ptr arduous. | |||
'''Recommendation:''' | |||
== Performance-related (rvalues) == | |||
http://thbecker.net/articles/rvalue_references/section_01.html | |||
=== Move Constructors === | |||
'''Motivation:''' | |||
'''Drawbacks:''' | |||
'''Recommendation:''' | |||
=== Reference Qualifiers === | |||
'''Motivation:''' | |||
'''Drawbacks:''' | |||
'''Recommendation:''' | |||
== Other C++11 features, less immediately useful == | |||
* Extended Unions (already have QVariant) | |||
* New literal types (already have QString) | |||
* Threads (Qt/KDE provide threading support already) | |||
* shared_ptr (unique_ptr Qt already provides a | |||
* Local types (mostly for advanced template programming) | |||
* static_assert | |||
* variadic templates |
Revision as of 01:26, 15 October 2015
General links to C++11 and Qt
Note: as would be expected from those interested in hot new technology, the writers of most of these links demonstrate Silicon Valley levels of extreme optimism. Take this with a grain of salt. There is no such thing as a free lunch.
- ICS.com
- qt.io
- woboq.com: c++11 in Qt5
- woboq.com: c++14 in Qt5
- "C++11 lambdas are your friend"
- Warning: c++11 range-based for may be slower
- FOSDEM 2013 presentation slides
- KDAB: speed up your Qt 5 programs using C++11
- Bjarne Stroustrup's C++11 FAQ - the grand daddy
Particular Features
Type Inference (auto)
Motivation:
Drawbacks:
Recommendation:
Range-based for loop
Motivation:
Drawbacks:
Recommendation:
Universal and General Initialization
Motivation: Member Initializers Mixed uniform initialization
Drawbacks:
Recommendation:
Lambda
Motivation: Lambda expressions for slots
Drawbacks:
Recommendation:
constexpr
Motivation:
Drawbacks:
Recommendation:
Override and final
Motivation:
Drawbacks:
Recommendation:
<algorithm>
Motivation:
Drawbacks:
Recommendation:
nullptr
Motivation:
Drawbacks:
Recommendation:
Deleted and default class members
Motivation:
Drawbacks:
Recommendation:
unique_ptr
Motivation:
Drawbacks: unique_ptr is unable to be copied, and therefore cannot be used inside Qt classes. For example QVector<std::unique_ptr> is invalid, because QVector requires its members can be copied. This makes converting to unique_ptr arduous.
Recommendation:
http://thbecker.net/articles/rvalue_references/section_01.html
Move Constructors
Motivation:
Drawbacks:
Recommendation:
Reference Qualifiers
Motivation:
Drawbacks:
Recommendation:
Other C++11 features, less immediately useful
- Extended Unions (already have QVariant)
- New literal types (already have QString)
- Threads (Qt/KDE provide threading support already)
- shared_ptr (unique_ptr Qt already provides a
- Local types (mostly for advanced template programming)
- static_assert
- variadic templates