C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::atomic_pointer_pair

From: Thiago Macieira <thiago_at_[hidden]>
Date: Thu, 08 Jan 2026 21:39:36 -0300
Ignoring the QoI discussion that is off-topic. If you think there are bugs,
report them or send patches.

On Thursday, 8 January 2026 21:24:19 Brasilia Standard Time Frederick
Virchanza Gotham via Std-Proposals wrote:
> I still think maybe the C++ Standard needs a new type,
> 'atomic_pointer_pair'. I think I need to do the following:

Why? What is the gain over rolling out one's own, like:

template <typename A = void, typename B = void> struct pointer_pair
{
    A *first;
    B *second;
};

std::atomic<pointer_pair>

In fact, the most common use won't use two pointers, but a pointer and a
generation counter. "atomic_pointer_pair" would be semantically the wrong
type.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.

Received on 2026-01-09 00:39:46