Daily bit(e) of C++ | Class Template Argument Deduction (CTAD)
Daily bit(e) of C++ ♻️183, Deducing template parameters from constructor arguments using C++17 Class Template Argument Deduction (CTAD).
The C++17 Class Template Argument Deduction (CTAD) enables class template deduction from the constructor call.
This removes redundant type information, often improving readability and removing the potential for unintended implicit conversions.
Custom types can additionally provide deduction guides (covered in a separate post), providing CTAD even when the constructor arguments do not match the template parameters.