Partial Class Template Argument Deduction in C 17: A Potential Future Feature
In C 17, class template argument deduction (CTAD) enables the compiler to infer template arguments based on the inferred type of a variable or expression. However, CTAD currently requires that all template arguments be specified or all be inferred.
This raises the question: is it possible to partially specify template arguments and have the remaining ones inferred?
Despite attempts such as using alias templates, direct partial deduction is still unavailable. However, there is a proposed paper (P1814) under consideration for C 20 that seeks to enable support for partial CTAD using alias templates.
Until such a proposal is accepted, there are no supported workarounds for implementing partial deduction. However, the upcoming C 20 standard draft includes support for Alias templates (P1814) and Aggregates (P1816), addressing some of the limitations of CTAD.
The above is the detailed content of Here are a few title options, keeping in mind the need for a question format and relevance to the article: **Option 1 (Direct and concise):** * **Can C 17 Achieve Partial Class Template Argument De. For more information, please follow other related articles on the PHP Chinese website!