3 ms·
Dear God, now I remember why I do not program in C++ anymore (Go and C# all the way!). That pre-11 code looked awful. If networking was nicer, I might actually
by feylikurds 11y ago
Dear God, now I remember why I do not program in C++ anymore (Go and C# all the way!). That pre-11 code looked awful. If networking was nicer, I might actually start considering recoding some of my projects in C++.
- nly 11y agoIt'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.
- dave2000 11y agoIf you have £40 or so, and a few evenings free, get the C++11 version of the Stroustrup programming language book and see what's changed. Modern C++ looks entirely different to older C++. Templates still a bit scary, so learn them or ignore them.
- feylikurds 11y agoYes, but are there still tons of boilerplate? Or is there a 11/14/17 library that incredibly decreases the amount of code needed? For example a HTTP listener with routing?