Hacker News new | ask | show | jobs
by pavanky 3736 days ago
That'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.
1 comments

Like this?

    auto it = std::find(begin(replicas), end(replicas), my_ip);
    return (end(replicas) == it ? -1 : std::distance(begin(replicas), it));
Yeah, i'll go with that.
Yeah that's what I was thinking.