This example is from a real-world code base, although variable names has been disguised. As it is only a cut-out, you don't have to understand the logic of the code. The example is here just to show you how the complexity is lowered when using algorithms compared with nested for-loops.
Using algorithms will also make the code cleaner. You can often write functions without nesting. In the for-loop version, it's hard to grasp when conflicting textures are set to true, whereas in the algorithm version, you can instinctively see that it happens if info fulfills a predicate.
The for-loop version | The STL algorithm version |
auto varies() -> bool {...}auto conflicting = ... |