Re:Clang vs. GCC – code coverage checking
by pavanky on Saturday April 02, 2016 @02:47PM
(#11412725)
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.
[ Parent
| on HN ]
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.