Improving Safety With Quantities and Units Library in C++
Safety has been a huge buzzword in the C++ Community in recent years. There are many concerns about the safety of our C++ language, and projects developed using it. Many improvements are being discussed, starting from handling of the low-level fundamental types, through updating the language rules (e.g., initialization), up to providing safer high-level abstractions in the library. This lecture presents how the usage of a Modern C++ quantities and units library can improve the safety of the code we write every day. During the talk, Mateusz will describe all issues and possible solutions discussed in P2981: Improving our safety with a physical quantities and units library. Based on the examples developed with the mp-units project, the attendees will not only learn the obvious benefits of using such a library but also some less known safety features will be presented. During the talk, we will see typical issues of code bases that do not use a proper library. We will also learn about various mishaps in engineering that happened through the ages and were caused by human errors in handling quantities and their units. We will also see how they can be easily and safely addressed using the mp-units library. In the end, Mateusz will describe which issues can't be solved by the quantities and units library itself for now. He will review a list of potential extensions to the C++ language and its library that would allow even more safety in our projects. Most of the contents of P2981: Improving our safety with a physical quantities and units library will be covered during the talk.
Back to Basics: Forwarding References - How to Forward Parameters in Modern C++
This talk is a part of the Back To Basics track and provides the introduction to Forwarding References. During the talk, we will learn why those references are so important that they got a special name and how to use `std::forward` with them. We will put a lot of effort into understanding when we are dealing with them in the source code, and when it is not the case. We will also try to answer the question if they really deserve a "universal reference", as some people call them, and see how they may improve the overload set we write. Finally, we will learn about potential pitfalls they may introduce and how to handle them.
Unleashing the Power of C++ Templates With mp-units: Lessons Learned and a New Library Design
This lecture presents how Modern C++ enables exciting features and attractive new design possibilities. The presented library pushes the boundaries of Modern C++ interfaces. Mateusz will present novel ways of using C++ templates benefiting from C++20 and C++23 features. mp-units is a Modern C++ library that provides compile-time dimensional analysis and unit/quantity manipulation. It heavily uses C++20 features like concepts and values of class types used as non-type template parameters (NTTPs). Also, it introduced a new powerful technique called the Downcasting Facility. During the talk, the library's author will describe the significant challenges with the initial design. He will explain the issues with the Downcasting Facility and why user-defined literals (UDLs) are not a good choice for creating quantities, and what the alternatives are. Mateusz will also describe additional requirements that couldn't be addressed with the previous framework and present how the new design addresses them. In the end, we will discuss potential C++ language features that could be helpful to improve the design of this and similar libraries.
Lightning Talk: Mismeasure for Measure (Part 1 of N)
A talk series showcasing physical units-related engineering mishaps and how to solve them with mp-units library.
Lightning Talk: Mismeasure for Measure (Part 2 of N)
A talk series showcasing physical units-related engineering mishaps and how to solve them with mp-units library.
Back to Basics - Name Lookup and Overload Resolution in C++
This talk explains how name lookup and overload resolution works. The language rules are not easy at all and may not be what one could expect. During the lecture, I will describe in detail how the process works, what are the pitfalls, and how to avoid them. This talk is part of the Back to Basics track and the material will be targeted to include all skill levels. Familiarity with the C++ language is recommended however no prior knowledge of name lookup or function overloads is required.
Software Engineering Is About Tradeoffs
This talk presents a view of a Software Architect. Often there is no such thing as "the best" solution for the problem. In many cases, we have to deal with compromises and accept the downsides of a specific approach. During the talk, I will mention some of the major tradeoffs and disagreements regarding the C++ design in recent years. I will also describe a few issues I personally encountered during the design of the mp-units (the modern C++ physical units) library and ask the audience to make a choice between several alternative solutions to the described problem.
CMake + Conan: 3 Years Later
This lecture is a continuation of my C++Now 2018 "Git, CMake, Conan: How to Ship and Reuse our C++ Projects" talk. This time I will share what I've learned and what has changed through the last three years in sharing and reusing C++ projects via CMake and Conan. I will share the updated best practices of packaging C++ projects and the most important highlights of the upcoming Conan 2.0. If you are interested in package management in large enterprise projects, you probably do not want to miss this talk.
A Physical Units Library For the Next C++
During CppCon 2019 Mateusz provided an overview of current solutions on the market as well as challenges of implementing a modern C++ physical units library. This year's talk will focus on 'mp-units', the library that was developed by Mateusz and contributors, and which is proposed for C++ standardization. During the tutorial, we will get familiar with the building blocks of the library's framework and its most important concepts. Numerous code examples will present how to use and solve real-life problems with the library. The audience will learn how easy it is to extend it with new units, dimensions, or even whole new systems of quantities. Last but not least Mateusz will provide a fair comparison of how well this library performs in comparison to other products on the market.
Rethinking the Way We Do Templates in C++ Even More
Template metaprogramming is hard. In case it is hard only for the library implementer then it is not that bad. The problem arises when it also affects the users of this library.
This talk is summarizing my experience and thoughts gathered during the implementation of the Physical Units Library
for C++. The way we do template metaprogramming now results with inscrutable compile-time errors and really long type
names observed while debugging our code. This is mostly caused by aliases of a primary class template instantiation
of complex metaprogramming interfaces. I will present a new technique that can highly improve our user experience here.
Next, the lecture scopes on new tools we get with C++20 that highly influence and improve compile-time code. Among others, we will talk about C++ concepts and class types as non-type template parameters. Also, we will discuss some additional extensions to the C++ language that could allow us to write even more generic code in the future.
Compilation times of such code also leave a lot of room for improvement, and the practices we chose to use in
the Standard Library are often suboptimal. Taking into account the Rule of Chiel while designing a templated code
makes a huge difference in compile times. This talk presents a few simple examples (including the practices from
the C++ Standard Library) of achieving the same goal in different ways and provides benchmark results of the time
needed to compile such source code.
Striving for ultimate low latency
That talk will present the C++ world seen from Low Latency domain. The world where no dynamic allocations are welcomed, C++ exceptions are nearly not used, where STL containers are often not enough, and where developers often need to go deep down to assembly level to verify if the code really does its best.
A C++ Approach to Physical Units
This talk presents a new C++20 library for Dimensional Analysis and Physical Units handling. The essential requirements of the library are user-friendliness, compile-time safety, no runtime overhead, and easy extensibility. The syntax of the library is built around a few easy to learn concepts and strictly checked at compile time, which makes it easy to learn and very forgiving for the novice. The talk presents motivating examples of why we need such a library, compares the library with other similar products on the market, describes the basic usage and interface, and highlights the benefits of the design choices made. The talk is also a great showcase of practical usage of new C++20 features that make the library interface easier to use, maintain, and extend. Concepts, contracts, class types provided as non-type template parameters, and other C++20 features make a huge difference in how we can design Modern C++ code.
Rethinking the Way We Do Templates in C++
Template metaprogramming is hard. In case it is hard only for the library implementer then it is not that bad. The problem arises when it also affects the users of this library. This talk is summarizing my experience and thoughts gathered during the implementation of the Physical Units Library for C++. The way we do template metaprogramming now results with inscrutable compile-time errors and really long type names observed while debugging our code. That is mostly caused by aliasing class template specializations of non-trivial metaprogramming interface designs. Compilation times of such code also leave a lot of room for improvement, and the practices we chose to use in the Standard Library are often suboptimal. Taking into account the Rule of Chiel while designing templated code makes a huge difference in the compile times. This talk presents a few simple examples (including the practices from the C++ Standard Library) of achieving the same goal in different ways and provides benchmark results of time needed to compile such source code.
Implementing a Physical Units Library for C++
This talk will present the current state of my work on designing and implementing Physical Units Library for C++. I will present all the challenges, design tradeoffs, and potential solutions to those problems. During the lecture, we will also see how new C++20 features help to make the library interface easier to use, maintain, and extend. Among others, we will see how we can benefit from class types provided as non-type template parameters, how new class template argument deduction rules simplify the interfaces, and a full power of using concepts to constrain template types.
Beyond C++17 (Part 2 of N)
Last year on C++Now I provided a "Beyond C++17" talk that described a current status of work on C++20. For last 12 months we received not only a lot of new features but some existing things were changed too. This talk will scope only on such additions and changes assuming that the audience is already familiar with the contents described a year ago. I will talk about contracts, generic functions, constraints, concepts, ranges, constexpr'ing all the things, immediate functions, "fixing" UTF-8 and aggregates, and many other hot topics.
C++11 Was Only the Beginning
C++ is the fastest programming language in the world, and it leaves no room for other languages below it (except assembler). That is why it gets more attention now than ever before. As a result, we observe an increasing speed of C++ language evolution. C++11 was a game changer, but is now considered an "old" language already. C++14 & 17 provided many improvements that allow us to write portable, safer, and faster code in a shorter time. The resulting source code is easier to reason about and maintain. Moreover, C++20 is coming soon, and it is going to be a game changer again.
In my talk, I provide a few typical legacy code examples that most of us write every day. I describe how those samples evolve
with the changes introduced in the each C++ language release from C++11 up to the major groundbreaking features of the upcoming
C++20. During the talk, the audience will learn how much easier, more robust, and safer is the code written using modern tools
that we get with every new C++ release.
C++ Concepts and Ranges: How to use them?
The most of the Concepts TS and Ranges TS is merged into the C++20 standard draft document. The talk will present a current design of those features and will provide suggestions on how to use them in our source code. That presentation is meant to inspire discussion on how should we use those long-awaited features while building tools and the C++ Standard Library.
Git, CMake, Conan: How to Ship and Reuse our C++ Projects
The purpose of that presentation is to solve the problems of build system and packaging that we have with large, multi-platform, C++ projects with many open source dependencies. Git and CMake are already established standards in our community. However, it is not clear how to use them in an efficient way. As a result, many C++ projects have problems with either importing other dependencies or making themselves easy to import by others. The talk will describe how Conan package manager - a new contender on the market may address those use cases.
Effective replacement of dynamic polymorphism with std::variant
This short talk presents how easy it is to replace some cases of dynamic polymorphism with std::variant. During the lecture, we will analyze and compare 2 implementations of the same simple Finite State Machine. It turns up that variant-based code is not only much faster but also it gives us the opportunity to define our interfaces and program flow much better. The talk will end up with the discussion of pros and cons of each approach and will try to give guidelines on when to use them.
How to create slides about CMake with CMake?
This short Lightning Talk presents how one can create slides for C++ talks using CMake to generate content for remark.js.
Beyond C++17
Presentation of features already voted into C++20 Standard Draft in Toronto, Albuquerque, and Jacksonville ISO C++ Committee Meetings as well as the overview of other really promising proposals that have high chances to arrive in C++20.
Pointless Pointers – How to make our interfaces efficient?
C++ is not C. C++ developers too often forget about that. The effects are often disastrous. nullptr dereferences, buffer overflows, resource leaks are the problems often seen in C++ applications bug trackers. Does it have to be like that? The talk presents a few simple rules tested in production that will make most of those issues go away and never appear again in the C++ software. Interested? Come and see :-)
std::shared_ptr<T> - (Not so) Smart hammer for every pointy nail
C++ rule of thumb is “you do not pay for what you do not use”. However, it turns out that this is not the case for some of the utilities from the C++ Standard Library. The key example here is the favorite tool of many developers – std::shared_ptr. The talk will describe the problems related to it in detail. It will also try to answer the question how it was possible to avoid them.
Small Lie in Big O
Writing fast C++ applications is a really complex subject. It often turns out that deep but isolated knowledge of ISO C++ standard and algorithmic complexity of operations does not guarantee the success. Often the bottleneck of our applications happens to be the performance of computer’s memory or its wrong usage by our code. The lack of knowledge in that subject can ruin all our ambitions to create high performance implementation.
All videos with Train IT trainers
All videos with or by Train IT trainers. It includes all lectures performed on various conferences around the world, interviews, video chats, and more. All of this can be found on Train IT YouTube channel.
Train IT Conference Slides
Presentations from all conferences and events performed by Train IT trainers can be found on Train IT GitHub.
WG21 (ISO C++ Committee) Papers
All papers with proposals of changes to ISO C++ Standard written by Train IT can be found on GitHub.IO.