jeudi 23 mai 2019

inline auto in template heading

I have got a problem to understand but since I'm new to c++ , I'm facing difficulties in understanding basic concepts of use of inline auto with templates, arrowhead operator?. Following is the code snippet

template <typename T> inline auto
max (const T& a, const T& b, const T& c) -> const T&
{
    return std::min (std::max (a, b), c) ;
}

Although i understand the use of inline and auto with functions like inline keyword replaced the call to function with its body and auto is for auto detecting the type, but i don't understood its use here with templates despite spending much time on google. Also, i'm confused in use of arrow head here as i think arrow is used to access through pointer but still i'm confused.

If someone would explain this code at basic level , would help alot. Sorry if this is very basic as i'm new to c++.

Aucun commentaire:

Enregistrer un commentaire