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

David Holmes dholmes at openjdk.org
Thu Oct 26 02:27:34 UTC 2023


On Wed, 25 Oct 2023 04:07:12 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> src/hotspot/share/utilities/growableArray.hpp line 213:
>> 
>>> 211: 
>>> 212:   template<typename T>
>>> 213:   int find(T* token, bool f(T*, const E&)) const {
>> 
>> What is the advantage of a const reference here?
>
> You can bind a non-const reference to a const one but not the other way.

Sorry I was unclear: what is the advantage of a reference here? Is it just to avoid copying

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

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


More information about the serviceability-dev mailing list