[PATCH] libstdc++: add support for cv-qualified types in atomic_ref (P3323R1)

Giuseppe D'Angelo giuseppe.dangelo@kdab.com
Mon Dec 9 11:52:12 GMT 2024


Hello,

The attached patch implements P3323R1, a DR against C++20 (11?), which 
fixes LWG 4069 and 3508 by clarifying that std::atomic_ref<cv T> is 
meant to be supported (whereas std::atomic<cv T> is meant to be 
unsupported).

I've tried to keep the refactorings to a minimum and follow the 
structure of the existing code, where atomic_ref<T> dispatched to a 
__atomic_ref<T> base class which had specializations for various kinds 
of T (integral, fp, pointer). The mutating operations on an 
atomic_ref<T> are now constrained on whether T is const or not, so I 
split __atomic_ref into a further subclass (__atomic_ref_base) that 
contains the non-mutating operations. __atomic_ref inherits from _base 
and adds the mutating operations if T is non const.

Thanks,
-- 
Giuseppe D'Angelo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libstdc-add-support-for-cv-qualified-types-in-atomic.patch
Type: text/x-patch
Size: 43571 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20241209/ab764554/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4244 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20241209/ab764554/attachment-0001.p7s>


More information about the Libstdc++ mailing list