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

Quan Anh Mai qamai at openjdk.org
Wed Oct 25 04:09:39 UTC 2023


On Wed, 25 Oct 2023 03:59:06 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Afshin Zafari has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains seven commits:
>> 
>>  - Merge remote-tracking branch 'upstream/master' into _8314502
>>  - first arg of `find` casted to `uint*`
>>  - Merge branch 'master' into _8314502
>>  - changed the `E` param of find methods to `const E&`.
>>  - find_from_end and its caller are also updated.
>>  - 8314502: Change the comparator taking version of GrowableArray::find to be a template method
>>  - 8314502: GrowableArray: Make find with comparator take template
>
> 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.

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

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


More information about the serviceability-dev mailing list