An analysis and exploration of partition and remove algorithms. By combining aspects of these two, we rediscover useful algorithms that the Standard Library doesn't have.
Experiments in partition and remove
by Brent Friedman
From the article:
The C++ Standard Library exposes dozens of powerful algorithms for use in everyday software. Two of these algorithms, partition and remove_if, provide similar functionality for segregating data. If we dig carefully into implementations of these algorithms, a certain symmetry is exposed. This exploration will lead us to the discovery of useful algorithms that we can employ in our daily engineering work.
This article demonstrates particular algorithm implementations — but it is important to remember that the source code will vary between different implementations of the standard library, and can differ based on what sort of data you pass in.
Add a Comment
Comments are closed.