by etrain · 10y ago · 0 comments
That said, I'd expect something similar to happen with a well-written C program. Would equivalent abstractions in C++1{1,4,7} be "costly"?
With C the lack of generics means that writing composable iterators is hard, though.
However, Boost offers iterator adapters, which although weaker than true iterator adapters (which C++ calls ranges), those will suffice in this case.
Good implementations can cheat and use knowledge my code shouldn't have about parts of the underlying system and bad ones do extra useless crap.
Benchmarking and profiling seem to be the only real way to gain confidence in your results reliably.