Re:Clang vs. GCC – code coverage checking
by nly on Saturday April 02, 2016 @02:42PM
(#11412700)
It's hard to say what he was trying to accomplish, but he probably could have written something like this.
[ Parent
| on HN ]
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.
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.