Skip to content

Commit 205c8fc

Browse files
committed
NB Comment GB13-309
1 parent db0d9d1 commit 205c8fc

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
make concat.html
3939
make P2483R0.html
4040
make ref_wrapper_common_ref.html
41+
make atomic.html
4142
4243
- name: Deploy 🚀
4344
uses: JamesIves/github-pages-deploy-action@v4.2.2

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
- [`any_view`](https://huixie90.github.io/cpp_papers/generated/any_view)
66
- [`flat_meow` Fixes](https://huixie90.github.io/cpp_papers/generated/flat_map)
77
- [`zip()` Should be an Infinite Range](https://huixie90.github.io/cpp_papers/generated/zip)
8+
- [Proposed Resolution for NB Comment GB13-309 `atomic_ref<T>` is not convertible to `atomic_ref<const T>`](https://huixie90.github.io/cpp_papers/generated/atomic)

atomic.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: "Proposed Resolution for NB Comment GB13-309 `atomic_ref<T>` is not convertible to `atomic_ref<const T>`"
3+
document: PXXXXR0
4+
date: 2025-10-04
5+
audience: LEWG, LWG
6+
author:
7+
- name: Hui Xie
8+
email: <hui.xie1990@gmail.com>
9+
- name: Damien Lebrun-Grandié
10+
email: <lebrungrandt@ornl.gov>
11+
toc: true
12+
---
13+
14+
15+
# Abstract
16+
17+
This paper proposes a converting constructor for `atomic_ref` as the resolution for UK NB Comment GB13-309.
18+
19+
# Introduction
20+
21+
The UK NB Comment GB13-309 pointed out that `atomic_ref<T>` is not convertible to `atomic_ref<const T>`. [@P3323R1] added cv qualifiers to `atomic` and `atomic_ref`. However, the conversion constructor of `atomic_ref` between different cv qualifiers is overlooked.
22+
23+
# Wording
24+
25+
Change [atomics.ref.generic.general]{.sref} as follows:
26+
27+
```cpp
28+
constexpr explicit atomic_ref(T&);
29+
constexpr atomic_ref(const atomic_ref&) noexcept;
30+
@[`template <class U>`]{.add}@
31+
@[`constexpr atomic_ref(const atomic_ref<U>&);`]{.add}@
32+
```
33+
34+
Add a new entry to [atomics.ref.ops]{.sref} after paragraph 8:
35+
36+
:::add
37+
38+
```cpp
39+
template <class U>
40+
constexpr atomic_ref(const atomic_ref<U>& ref);
41+
```
42+
43+
[9]{.pnum} *Contraints*:
44+
45+
- [9.1]{.pnum} `is_same_v<remove_cv_t<T>, remove_cv_t<U>>` is `true`, and
46+
47+
- [9.2]{.pnum} `is_convertible_v<U*, T*>` is `true`
48+
49+
[10]{.pnum} *Postconditions*: `*this` references the object referenced by `ref`.
50+
51+
:::
52+
53+
# Implementation Experience
54+
55+
[@P3323R1] is currently being implemented in libc++ and adding the proposed constructor is under way.
56+
57+
# Feature Test Macro
58+
59+
[@P3323R1] does not seem to mention Feature Test Macro
60+
61+
<style>
62+
.bq{
63+
display: block;
64+
margin-block-start: 1em;
65+
margin-block-end: 1em;
66+
margin-inline-start: 40px;
67+
margin-inline-end: 40px;
68+
}
69+
</style>

0 commit comments

Comments
 (0)