Alle boeken

Professioneel

Apps Over Coach Inloggen Begin met lezen

Computer Science · Begrippenlijst

Wat is Template argument deduction?

Definition 4.2 University Computer Science — Year 2 · Hoofdstuk 4 — Templates and Generic Programming

At a call of a function template with no explicit arguments, the compiler finds the template arguments by template argument deduction: it matches each parameter type against the type of the corresponding argument. Each template parameter must be deduced to a single type from all the arguments in which it appears; a parameter that appears in no function parameter (only in the return type, say) cannot be deduced, and must be given explicitly, as in larger<double>(3, 7.5).

Lees in het hoofdstuk →