I'm confused why the book I'm reading says that the following two declarations have the same effect:
template<typename T1, typename T2> auto max (T1 a, T2 b) -> decltype(b<a?a:b);
template<typename T1, typename T2> auto max (T1 a, T2 b) -> decltype(true?a:b);
In the first declaration, the return type of max(a, b)
could be the type of a
, or the type of b
. In the second declaration, the return type is the type of a
. How can the two declarations have the same effect?
Here is the passage that I read:
Aucun commentaire:
Enregistrer un commentaire