less<TYPE>

Aug 6, 2016 at 10:46am
template <typename T,typename F=less<T>>
int compare(const T &v1,const T &v2,F f=F())
{

}

I can't understand "F f=F()",because the return_type of less<T> is bool,so why a bool can be given to f ,its rerutn_type is typename less<T>.
Last edited on Aug 6, 2016 at 10:47am
Aug 6, 2016 at 1:22pm
F() - an anonymous temporary object of type F (which is value initialised)
http://en.cppreference.com/w/cpp/language/value_initialization
Last edited on Aug 6, 2016 at 1:22pm
Topic archived. No new replies allowed.