I have problem understand why this works correctly?
//#include <algorithm>
template<class T>
const T& min(const T& a, const T& b){
return (b < a) ? b : a;
}
int main(){
int x = /*std*/ min(5 - 1, 5 + 1);
return x;
}
If we get const reference
in a
, how it survive "returning" const reference
?
Is this because function is inlined?
Aucun commentaire:
Enregistrer un commentaire