Implementing std::invoke in C++14
I've added sort_by to KDAlgorithms. This required that I for C++14 had to implement what in C++17 is known as std::invoke. In this video, I'll give you some insights into what that involved. It will, among a lot of other things, take us by: - SFINAE and tag dispatching - if constexpr - parameter packs - static_assert Links: * Type Traits: https://en.cppreference.com/w/cpp/header/type_traits * Mini series on templates: https://youtu.be/BQEJ_HPLtps?list=PL6CJYn40gN6gf-G-o6syFwGrtq3kItEqI * Episode on type traits: https://youtu.be/LzkxgfvvHqY?list=PL6CJYn40gN6gf-G-o6syFwGrtq3kItEqI * Full version of the C++14 invoke in kdalgorithms: https://github.com/KDAB/KDAlgorithms/blob/main/src/kdalgorithms_bits/invoke.h 0:00 Introduction 1:12 The problem with std::sort 2:24 Introducing sort_by taking a member to sort by. 4:45 The problem to solve - std::invoke 5:44 sort_by in C++17 using std::invoke 6:14 Recapture - the building blocks 8:48 SFINAE 13:03 This is a simplified version 13:27 Pointers versus instances plus lambda's 16:02 What would invoke look like in C++17 18:56 Variable amount of arguments 21:12 Finally variable amount of arguments in the C++14 version 22:21 The final version is in github All QML tips and tricks videos : https://www.youtube.com/playlist?list=PL6CJYn40gN6jWHP5krsQrVGyYtKh3A3be All Qt Widgets and more videos: https://www.youtube.com/playlist?list=PL6CJYn40gN6gf-G-o6syFwGrtq3kItEqI The example code showcased in this video is available here: https://github.com/KDAB/kdabtv/tree/master/Qt-Widgets-and-more/invoke 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. Every month our newsletter is featuring technical blogs on Qt, C++ and 3D topics: https://www.kdab.com/development-resources/sign-up-for-our-newsletter/ About KDAB: KDAB offers experienced software experts to help you deliver functional, high-performing and innovative software across embedded, mobile and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D and more. https://www.kdab.com/software-services KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrolment courses around the world. We are the market leaders for training in Qt, OpenGL and C++. Contact us to find out more at [email protected] or visit our website: https://www.kdab.com/software-services/scheduled-training/ We are over 100 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK and the USA. https://www.kdab.com/about/contact/
Download
1 formatsVideo Formats
Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.