In Josuttis book I've got this example:
template<typename T1, typename T2>
auto max (T1 a, T2 b) -> decltype(b<a?a:b)
{
return b<a?a:b;
}
But the
b<a
part belongs to runtime, right? So why do we compare it in the decltype (to figure out the static type during the template instantiation)? And how does it work properly in compile time?
Aucun commentaire:
Enregistrer un commentaire