hkaiser changed the topic of #ste||ar to: STE||AR: Systems Technology, Emergent Parallelism, and Algorithm Research | stellar-group.org | HPX: A cure for performance impaired parallel applications | github.com/STEllAR-GROUP/hpx | This channel is logged: irclog.cct.lsu.edu
diehlpk_work has quit [Remote host closed the connection]
<gnikunj[m]>
std::max<int> doesn't declare which overload it is. I've had this conversation in another context with K-ballo before. Basically std::max<int> is not the function pointer unless you specify which overload to use. E.g.: `int const & (*max) (int const &, int const &) = std::max<int>;`. Now the function pointer `max` has the desired information and can be plugged to accumulate.
<gonidelis[m]>
why is that?
<gnikunj[m]>
Because the compiler canโt know which function to point to.
<gonidelis[m]>
std::max<int> **does** know which overload to use here after all
<gonidelis[m]>
problem is not `std::max<int>`, it's `std::max<int>` within an accumulate call (or any call that handles it as a function pointer)
<gonidelis[m]>
so question is: Why?
<gnikunj[m]>
std::accumulate gets a function pointer. It is not the same as calling `std::max<int>` directly. Compiler can't deduce the function pointer type by just seeing `std::max<int>`.
<gnikunj[m]>
That's why I shared that basic example where the compiler can't deduce `foo` from `auto* func = &foo`
tufei has quit [Remote host closed the connection]
tufei has joined #ste||ar
<gonidelis[m]>
that's what I said and the inference that we begin with. The question is why "Compiler can't deduce a function pointer type by just std::max<int>"
<gonidelis[m]>
I can see that it happens from your example code. I don't see why tho
hkaiser has joined #ste||ar
<gonidelis[m]>
hkaiser: help
<hkaiser>
wazzup?
<gnikunj[m]>
gonidelis: overload sets are not values in C++