We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Embracing CTAD - Nina Ranns - CppCon 2023
Discover the power of CTAD, a C++ feature that simplifies initializing containers and more, with this talk exploring its applications, limitations, and potential for coding expressiveness.
- CTAD (Class Template Argument Deduction) is a feature in C++ that automatically deduces template arguments for a class template.
- It’s not a new syntax, but rather a set of rules that the compiler applies to deduce the template arguments.
- CTAD was introduced in C++17 and has been expanded in C++20.
- The motivation for CTAD was to simplify the process of initializing containers from iterators.
- CTAD works by analyzing the constructor calls and deducing the template arguments based on the types of the arguments.
- It’s not just limited to simple cases, but can also handle more complex cases such as nested templates and non-type template parameters.
- CTAD is not a replacement for template argument deduction, but rather a complement to it.
- The author of the talk believes that CTAD is a powerful feature that can make code easier to write and maintain.
- However, it’s not a silver bullet and there are still cases where template argument deduction is necessary.
- The author also mentions that CTAD can be used to write more expressive and concise code.
- The talk also touches on the topic of deduction guides, which are a way to customize the deduction process for a specific class template.
- The author believes that deduction guides are a useful feature that can help to make CTAD more powerful and flexible.
- The talk also mentions that CTAD is not without its limitations and there are still cases where it’s not possible to use it.
- The author believes that the benefits of CTAD outweigh the drawbacks and that it’s a feature that should be used more widely.
- The talk also mentions that CTAD is not a new concept, but rather a refinement of existing concepts in C++.
- The author believes that CTAD is a feature that will become more important in the future as C++ continues to evolve.