4 ms·
It's hard to say what he was trying to accomplish, but he probably could have written something like this. auto index = std::distance (begin(replicas),
by nly 11y ago
It's hard to say what he was trying to accomplish, but he probably could have written something like this.
auto index = std::distance (begin(replicas),
std::find(begin(replicas), end(replicas), my_ip));
return (replicas.size() == index ? -1 : index);
- pavanky 11y agoThat's a bit harder to read isn't it? I think finding the location in first line and using distance in the ternary operator makes it more readable.