filmov
tv
The C++ Explicit Keyword and Qt

Показать описание
C++ has a keyword called explicit, but why are there no implicit keywords?
Further how can it possibly be needed in the context of QObjects? And is there any tooling available that can help me ensure that it is everywhere, or that I at least have thought carefully about it, in those places where it should be?
Get these answers and many more in this episode where I talk to Peppe.
0:00 Inbtroduction
1:46 Implicit conversion in a string class
5:00 implicit conversion going wrong
8:00 the explicit keywords to the rescue
9:29 Named constructors
11:00 Why is explicit a problem in the contest of QObject sub-classes?
19:44 Should I always use explicit?
23:33 Q_IMPLICIT
24:33 explicit(false)
25:48 Implementation of Q_IMPLICIT
26:39 clang-tidy support
31:16 When should I not use explicit - QPoint
34:13 Rule of thumb when implicit is OK
Links:
All Qt Widgets and more videos:
About the host:
The video is presented by Jesper Pedersen, who started with Qt back when Qt was widgets only and the version was 1.44, which gives him 21 years of experience with Qt. Since 2000 he has taught almost 100 Qt classes, ranging from Qt Widgets to QML. Heck, Jesper even taught a few classes on QTopia Core — Trolltech's initial attempt at creating a phone stack. Today Jesper holds a fancy business title, but that doesn't prevent him from coding both in his job and in his spare time.
About KDAB:
KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL and C++.
Further how can it possibly be needed in the context of QObjects? And is there any tooling available that can help me ensure that it is everywhere, or that I at least have thought carefully about it, in those places where it should be?
Get these answers and many more in this episode where I talk to Peppe.
0:00 Inbtroduction
1:46 Implicit conversion in a string class
5:00 implicit conversion going wrong
8:00 the explicit keywords to the rescue
9:29 Named constructors
11:00 Why is explicit a problem in the contest of QObject sub-classes?
19:44 Should I always use explicit?
23:33 Q_IMPLICIT
24:33 explicit(false)
25:48 Implementation of Q_IMPLICIT
26:39 clang-tidy support
31:16 When should I not use explicit - QPoint
34:13 Rule of thumb when implicit is OK
Links:
All Qt Widgets and more videos:
About the host:
The video is presented by Jesper Pedersen, who started with Qt back when Qt was widgets only and the version was 1.44, which gives him 21 years of experience with Qt. Since 2000 he has taught almost 100 Qt classes, ranging from Qt Widgets to QML. Heck, Jesper even taught a few classes on QTopia Core — Trolltech's initial attempt at creating a phone stack. Today Jesper holds a fancy business title, but that doesn't prevent him from coding both in his job and in his spare time.
About KDAB:
KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL and C++.
Комментарии