RFR: 8189088: Add intrusive doubly-linked list utility [v3]

Kim Barrett kbarrett at openjdk.org
Mon Oct 16 04:38:53 UTC 2023


On Mon, 9 Oct 2023 13:17:03 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> Is something like this more clear? In my experience, non-intrusive collections
>> with const-qualified elements are uncommon, so I found the implications here
>> not immediately obvious.
>> 
>> 
>>  * A const iterator has a const-qualified element type, and provides const
>>  * access to the elements of the associated list.  A non-const iterator has an
>>  * unqualified element type, and provides mutable element access.  A non-const
>>  * iterator is implicitly convertible to a corresponding const iterator.
>>  *
>>  * A const list provides const iterators and access to const-qualified
>>  * elements, and cannot be used to modify the sequence of elements.  Only a
>>  * non-const list can be used to modify the sequence of elements.
>>  *
>>  * A list can have a const-qualified element type, providing const iterators
>>  * and access to const-qualified elements.  A const object cannot be added to
>>  * a list with an unqualified element type, as that wuold be an implicit
>>  * casting away of the const qualifier.
>
> Nit typo: s/wuold/would/

My suggestion isn't quite right either; the nomenclature for a list/iterator with const elements needs a new term.
I've pushed another rewrite, defining the terms "const-element list/iterator" and using that terminology elsewhere.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15896#discussion_r1360093199


More information about the hotspot-dev mailing list