Quote Originally Posted by tiliavirga
I personally prefer structure over logic and that's why the (benign) goto in my solution doesn't bother me at all.
I don't quite understand what you mean by "structure over logic" here though: isn't the structure entirely a logical structure?

One advantage of using the generic algorithm is that the abstraction provides the reader with immediate information, i.e., instead of parsing the loop to figure out what it does, the reader knows that the aim is to try and find something. The logical structure remains essentially the same, except that part of the details is hidden by an abstraction. In this particular case, an additional advantage is that now we only need to break from a non-nested loop, so the simple break does the job.

Quote Originally Posted by tiliavirga
And if break is so disgusting
You are mistaken: the break (whether the keyword or simulated with goto because C++'s break does not allow breaking from within an inner loop out of an outer loop) is not disgusting. Rather, it is appropriate to the logic here, and in fact I notice that it is you who wrote the appropriately used goto in the first place.

Quote Originally Posted by tiliavirga
why didn't you replace the outermost loop with a function too (say find_if).
I think that the range-based for loop would be sufficient. Using find_if would not necessarily improve the readability of the code because the predicate might not be simpler than the current loop body.

Instead, for abstraction, the entire code snippet could be moved to a separate function instead to abstract away the entire "want to know which PDN it belongs to" search logic.

Quote Originally Posted by tiliavirga
That would remove also the remaning break from your code.
Removing a break just for the sake of removing a break, without improving the readability of the code, is a misguided approach.