[PATCH] Add fancy pointer support in std::map/set
Jonathan Wakely
jwakely.gcc@gmail.com
Tue Oct 8 21:55:01 GMT 2024
On Tue, 8 Oct 2024 at 22:50, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>
>
> On Thu, 1 Aug 2024 at 18:28, François Dumont <frs.dumont@gmail.com> wrote:
>
>> Hi
>>
>> Here is a proposal to add fancy pointer support in std::_Rb_tree
>> container.
>>
>> As you'll see there are still several usages of
>> pointer_traits<>::pointer_to. The ones in _M_header_ptr() are
>> unavoidable.
>
>
> Yes, those are necessary.
>
> The pointer_to use in _M_const_cast could be simplified by adding a
> _M_self_ptr() member to _Rb_tree_pnode_base:
>
> _Base_ptr
> _M_self_ptr() _GLIBCXX_NOEXCEPT
> { return pointer_traits<_Base_ptr>::pointer_to(*this); }
>
> _Base_ptr
> _M_self_ptr_nc() const _GLIBCXX_NOEXCEPT
> {
> auto __self = const_cast<_Rb_tree_pnode_base*>(this);
> return __self->_M_self_ptr();
> }
>
You might not even need this const overload:
>
> _Const_Base_ptr
> _M_self_ptr() const _GLIBCXX_NOEXCEPT
> { return pointer_traits<_Const_Base_ptr>::pointer_to(*this); }
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20241008/3d1d9e15/attachment.htm>
More information about the Libstdc++
mailing list