Hacker News new | past | comments | ask | show | jobs | submit login

The resize step at the end is a defect of how C++'s collections work. Ideally, I'd like to be able to say that there are two collections, possibly stored in the same buffer so long as they don't overlap:

(0) A collection of elements to be processed (given by an InputIterator range).

(1) A collection of already processed elements (given by an OutputIterator range).

When the algorithm starts running, (1) is empty. With each iteration of the algorithm's loop, (0) becomes smaller and (1) becomes larger [maybe]. When the algorithm halts, (0) is empty.

Notice that, while both collections share the same underlying buffer, each has its own size. So there is no need to perform a `resize()` step at the end.




That sounds super neat, and also super hard to specify and implement, in either C++ or Ruby.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: