Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 78 additions & 49 deletions DRAFT.md
Original file line number Diff line number Diff line change
Expand Up @@ -603,34 +603,6 @@ the allocators are not swapped.

4. _Throws_: Any exception thrown by the called function.

<!--
```cpp
constexpr void swap(protocol& lhs, protocol& rhs) noexcept(noexcept(lhs.swap(rhs)));
```

4. _Effects_: Equivalent to lhs.swap(rhs).

??

```cpp
template<class I, class Allocator>
void swap(protocol<I, Allocator>& x, protocol<I, Allocator>& y)
noexcept(noexcept(x.swap(y)));
```

4. _Effects_: Calls `x.swap(y)`.
-->

<!--
#### X.Y.9 Allocator support [protocol.alloc]

```cpp
constexpr allocator_type get_allocator() const;
```

1. _Returns_: `alloc`.
-->

### X.Z Class template protocol_view [protocol_view]

#### X.Z.1 Class template protocol_view general [protocol_view.general]
Expand Down Expand Up @@ -662,14 +634,18 @@ class protocol_view {
template<class T>
constexpr protocol_view(T& t) noexcept;

template<class T>
protocol_view(T&&) = delete;

template<class Allocator>
constexpr protocol_view(protocol<I, Allocator>& p) noexcept;

template<class Allocator>
protocol_view(protocol<I, Allocator>&&) = delete;

constexpr protocol_view(const protocol_view&) noexcept = default;

constexpr protocol_view& operator=(const protocol_view&) noexcept = default;
private:
I* data_; // exposition only
};

template <class I>
Expand All @@ -680,19 +656,31 @@ class protocol_view<const I> {
template<class T>
constexpr protocol_view(const T& t) noexcept;

template<class T>
protocol_view(const T&&) = delete;

template<class Allocator>
constexpr protocol_view(protocol<I, Allocator>& p) noexcept;

template<class Allocator>
protocol_view(protocol<I, Allocator>&&) = delete;

template<class Allocator>
constexpr protocol_view(const protocol<I, Allocator>& p) noexcept;

template<class Allocator>
protocol_view(const protocol<I, Allocator>&&) = delete;

constexpr protocol_view(const protocol_view<I>& view) noexcept;

protocol_view(protocol_view<I>&&) = delete;

constexpr protocol_view(const protocol_view&) noexcept = default;

constexpr protocol_view& operator=(const protocol_view&) noexcept = default;
private:
const I* data_; // exposition only
//private:
//void* object_ptr_; // exposition only
//const void* dispatch_table_; // exposition only
};
Comment on lines 678 to 684
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The synopsis now has the representation for protocol_view<const I> commented out (including the private: label), and protocol_view<I> no longer shows any exposition-only state. This makes later wording like "stored reference"/member-access preconditions harder to interpret. Consider restoring a consistent private: section with exposition-only members (as done for protocol in [protocol.syn]) or removing representation-dependent wording elsewhere.

Copilot uses AI. Check for mistakes.
```

Expand All @@ -707,24 +695,38 @@ constexpr protocol_view(T& t) noexcept;

2. _Preconditions_: `t` shall refer to an object that is valid and remains valid for the lifetime of `*this`.

3. _Effects_: Initializes `data_` to `std::addressof(t)`.
3. _Effects_: Stores a reference to the object `t`.

```cpp
template<class T>
protocol_view(T&&) = delete;
```

4. _Remarks_: Rvalue references are deleted to prevent dangling references to temporary objects.

```cpp
template<class Allocator>
constexpr protocol_view(protocol<I, Allocator>& p) noexcept;
```

4. _Preconditions_: protocol `p` is not valueless.
4. _Preconditions_: protocol `p` is not valueless after move.
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In [protocol_view.ctor], the item numbering becomes inconsistent after adding the deleted rvalue overloads (e.g., repeats "4." and then jumps to "6."/"7." with no "5."). Please renumber the Preconditions/Effects/Remarks items so the list is strictly increasing and unambiguous.

Suggested change
4. _Preconditions_: protocol `p` is not valueless after move.
5. _Preconditions_: protocol `p` is not valueless after move.

Copilot uses AI. Check for mistakes.

6. _Effects_: Stores a reference to the object held by `p`.

```cpp
template<class Allocator>
protocol_view(protocol<I, Allocator>&&) = delete;
```

5. _Effects_: Initializes `data_` to `std::addressof(*p)`.
7. _Remarks_: Rvalue references are deleted to prevent dangling references to temporary protocol objects.

```cpp
constexpr protocol_view(const protocol_view& other) noexcept = default;
```

6. _Postconditions_: `other.data_ == data_`.
8. _Effects_: Initializes a new view referring to the same object as `other`.

#### X.Z.4 Class template partial specialization `protocol_view<const I>` constructors [protocol_view.const.ctor]
#### X.Z.4 Constructors for `protocol_view<const I>` [protocol_view.const.ctor]

```cpp
template<class T>
Expand All @@ -735,57 +737,84 @@ constexpr protocol_view(const T& t) noexcept;

2. _Preconditions_: `t` shall refer to an object that is valid and remains valid for the lifetime of `*this`.

3. _Effects_: Initializes `data_` with the address of `t`.
3. _Effects_: Stores a reference to the object `t`.

```cpp
template<class T>
protocol_view(const T&&) = delete;
```

4. _Remarks_: Rvalue references are deleted to prevent dangling references to temporary objects.

```cpp
template<class Allocator>
constexpr protocol_view(protocol<I, Allocator>& p) noexcept;
```

4. _Preconditions_: protocol `p` is not valueless.
4. _Preconditions_: protocol `p` is not valueless after move.
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In [protocol_view.const.ctor], numbering is inconsistent after the new deleted rvalue overloads (e.g., "4. Preconditions" appears again after "4. Remarks", then jumps to "6."/"9."/"10."). Please renumber the items across this subclause to avoid duplicate or skipped item numbers.

Suggested change
4. _Preconditions_: protocol `p` is not valueless after move.
5. _Preconditions_: protocol `p` is not valueless after move.

Copilot uses AI. Check for mistakes.

6. _Effects_: Stores a reference to the object held by `p`.

5. _Effects_: Initializes `data_` to `std::addressof(*p)`.
```cpp
template<class Allocator>
protocol_view(protocol<I, Allocator>&&) = delete;
```

7. _Remarks_: Rvalue references are deleted to prevent dangling references to temporary protocol objects.

```cpp
template<class Allocator>
constexpr protocol_view(const protocol<I, Allocator>& p) noexcept;
```

6. _Preconditions_: protocol `p` is not valueless.
6. _Preconditions_: protocol `p` is not valueless after move.

9. _Effects_: Stores a reference to the object held by `p`.

```cpp
template<class Allocator>
protocol_view(const protocol<I, Allocator>&&) = delete;
```

7. _Effects_: Initializes `data_` with the address of `*p`.
10. _Remarks_: Rvalue references are deleted to prevent dangling references to temporary protocol objects.

```cpp
constexpr protocol_view(const protocol_view<I>& view) noexcept;
```

8. _Preconditions_: The object referenced by `view` does not become invalid before use of `*this`.
11. _Preconditions_: The object referenced by `view` remains valid for the lifetime of `*this`.

9. _Effects_: Initializes `data_` with the address of the object referenced by `view`.
12. _Effects_: Stores a reference to the object referenced by `view`.

```cpp
protocol_view(protocol_view<I>&&) = delete;
```

13. _Remarks_: Rvalue references are deleted to prevent dangling references.
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The remark for deleting protocol_view(protocol_view<I>&&) says it prevents dangling references, but moving/copying a protocol_view does not create a dangling reference to the underlying object (it still refers to the same object). Either adjust the rationale (if the intent is different) or consider allowing construction from an rvalue protocol_view<I> since it is effectively the same as copying.

Suggested change
13. _Remarks_: Rvalue references are deleted to prevent dangling references.
13. _Remarks_: This constructor is deleted to disallow initialization from temporary `protocol_view` objects.

Copilot uses AI. Check for mistakes.

```cpp
constexpr protocol_view(const protocol_view& other) noexcept = default;
```

10. _Postconditions_: `other.data_ == data_`.
14. _Effects_: Initializes a new view referring to the same object as `other`.

#### X.Z.5 Assignment [protocol_view.assign]

```cpp
constexpr protocol_view& operator=(const protocol_view& other) noexcept = default;
```

1. _Postconditions_: `other.data_ == data_`.

1. _Effects_: Replaces the reference held by `*this` with a reference to the object referenced by `other`.

2. _Returns_: `*this`.

#### X.Z.6 Member access [protocol_view.member.access]

1. For each public non-static, non-template member function _f_ declared in _I_, `protocol_view<I>` shall contain a public non-virtual member function with an identical signature as specified in [protocol.member.access]. For `protocol_view<const I>`, only the member functions of _I_ that have a `const` cv-qualifier are provided.

2. _Preconditions_: `data_` does not equal `nullptr`.
2. _Preconditions_: The stored reference is not null and refers to a valid object.
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"The stored reference is not null" is internally inconsistent: references cannot be null. Either describe the representation as storing a pointer (and keep a non-null precondition), or reword the precondition to only require that the referenced object remains valid for the view’s lifetime.

Suggested change
2. _Preconditions_: The stored reference is not null and refers to a valid object.
2. _Preconditions_: The referenced object is valid.

Copilot uses AI. Check for mistakes.

3. _Effects_: Equivalent to calling the corresponding member function of the object referenced by `data_`.
3. _Effects_: Equivalent to calling the corresponding member function of the referenced object.

4. _Returns_: The value returned from the called function, if any.

Expand Down
Loading