RFR: 8314502: Change the comparator taking version of GrowableArray::find to be a template method [v4]

Afshin Zafari azafari at openjdk.org
Fri Sep 15 07:23:40 UTC 2023


On Thu, 7 Sep 2023 07:06:46 GMT, Afshin Zafari <azafari at openjdk.org> wrote:

>>> Also, why isn't this change also being applied to `find_from_end`
>> 
>> Thank you @kimbarrett, the function is also changed accordingly.
>
>> We could just as well do a capturing lambda here, yes. Then we'd have:
>> 
>> ```c++
>> template<F>
>> int find(F finder);
>> ```
>> 
>> It'd be a template instead of function pointer since it's a capturing lambda and `std::function` is not permitted in Hotspot AFAIK.
>> 
>> As an aside, to clarify for readers: There's a `&` missing in the capture list of your examples.
> 
> It would be nice to have this templated Function as finder. However, I think it is better to keep the changes small and manageable for this PR. Thanks for the comment.

> Also, why isn't this change also being applied to `find_from_end`

Thanks Kim! It is also changed.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/15418#discussion_r1326901038


More information about the hotspot-dev mailing list