On Fri, 25 Aug 2023 08:31:58 GMT, Johan Sjölen <jsjo...@openjdk.org> wrote:
>> src/hotspot/share/utilities/growableArray.hpp line 213: >> >>> 211: >>> 212: template<typename T> >>> 213: int find(T* token, bool f(T*, E)) const { >> >> Pardon my ignorance here, but what is the type relationship between T and E? > > It's arbitrary and chosen by the caller through `f`, so I can't say :-). The > best use case we have now is when you only have an `int` which uniquely > describes an `LGRPSpace`. This code looks similar to a capturing lambda. Would an alternative be to use that instead and let the calling code be changed to: int i = lgrp_spaces()->find([](LGRPSpace* space) { return space->lgrp_id() == lgrp_id; }); Alternatively: auto matches_lgrp_id = [](LGRPSpace* space) { return space->lgrp_id() == lgrp_id; }; int i = lgrp_spaces()->find(matches_lgrp_id); ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15418#discussion_r1305389552