Which of the following options is most suitable?
#include <iostream>

//...

// 1
inline int const& max(int const& a, int const& b)
{
    return a < b ? b : a;
}

// 2
template<typename T> 
inline T const& max (T const& a, T const& b)
{
    return a < b ? b : a;
}

//...
int main() 
{ 
    //...
    std::cout << ::max('a', 42.7) << std::endl; //3
    //...
    
    return 0; 
} 

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты