Tous les livres

Professionnel

Applis À propos Coach Connexion Commencer la lecture

Computer Science · Glossaire

Qu'est-ce que « Template argument deduction » ?

Definition 4.2 University Computer Science — Year 2 · Chapitre 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).

Lire dans le chapitre →