3 ms·
As I said, my C++ experience is limited. Thank you for demonstrating a better way to do it. Hopefully I'll remember that the next time that I need it. (Which
by btilly 14y ago
As I said, my C++ experience is limited.
Thank you for demonstrating a better way to do it. Hopefully I'll remember that the next time that I need it. (Which is likely to be several years from now.)
Also you're right that I would like streams and generators. But, to me, it is the same abstraction as iteration. See, for instance, how Python does it.
- marblar 14y agoYou should check out the boost iterator library. Depending on the application, you might be looking for either the function input iterator or the counting iterator.
- btilly 14y agoI have avoided learning boost for the simple reason that on the rare occasions when I need C++, it has been apparent to me that I could easily spend longer trying to evaluate whether anything that is available would be a good fit for my problem, than it would take to be done. Put another way, the effort of learning something needs to be amortized over all of the times that you'll likely use that knowledge. I use C++, rarely enough that I won't get much amortization. (And when I do use it, it is painful enough that I don't want to explore it just for personal enjoyment. Leading to my avoiding C++...)