Skip to content

Commit

Permalink
Update wording for allocate_proxy and make_proxy_inplace (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
mingxwa authored Sep 17, 2024
1 parent d8ee01f commit 40271e5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
12 changes: 8 additions & 4 deletions docs/allocate_proxy.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Function template `allocate_proxy`

The definition of `allocate_proxy` makes use of an exposition-only class template *allocated-ptr*. An object of type `allocated-ptr<T, Alloc>` allocates the storage for another object of type `T` with an allocator of type `Alloc` and manages the lifetime of this contained object. Similar with [`std::optional`](https://en.cppreference.com/w/cpp/utility/optional), `allocated-ptr<T, Alloc>` provides `operator*` for accessing the contained object with the same qualifiers, but does not necessarily support the state where the contained object is absent.
The definition of `allocate_proxy` makes use of an exposition-only class template *allocated-ptr*. An object of type `allocated-ptr<T, Alloc>` allocates the storage for another object of type `T` with an allocator of type `Alloc` and manages the lifetime of this contained object. Similar to [`std::optional`](https://en.cppreference.com/w/cpp/utility/optional), `allocated-ptr<T, Alloc>` provides `operator*` for accessing the managed object of type `T` with the same qualifiers, but does not necessarily support the state where the contained object is absent.

```cpp
// (1)
Expand All @@ -16,11 +16,11 @@ template <facade F, class Alloc, class T>
proxy<F> allocate_proxy(const Alloc& alloc, T&& value); // freestanding-deleted
```
`(1)` Creates a `proxy<F>` object containing an `allocated-ptr<T, Alloc>` direct-non-list-initialized with `std::forward<Args>(args)...`.
`(1)` Creates a `proxy<F>` object containing a value `p` of type `allocated-ptr<T, Alloc>`, where `*p` is direct-non-list-initialized with `std::forward<Args>(args)...`.
`(2)` Creates a `proxy<F>` object containing an `allocated-ptr<T, Alloc>` direct-non-list-initialized with `il, std::forward<Args>(args)...`.
`(2)` Creates a `proxy<F>` object containing a value `p` of type `allocated-ptr<T, Alloc>`, where `*p` is direct-non-list-initialized with `il, std::forward<Args>(args)...`.
`(3)` Creates a `proxy<F>` object containing an `allocated-ptr<std::decay_t<T>, Alloc>` direct-non-list-initialized with `std::forward<T>(value)`.
`(3)` Creates a `proxy<F>` object containing a value `p` of type `allocated-ptr<std::decay_t<T>, Alloc>`, where `*p` is direct-non-list-initialized with `std::forward<T>(value)`.
## Return Value
Expand All @@ -30,6 +30,10 @@ The constructed `proxy` object.
Throws any exception thrown by allocation or the constructor of `T`.
## Notes
The implementation of `allocated-ptr` may vary depending on the definition of `F`. Specifically, when `F::constraints.max_size` and `F::constraints.max_align` are not large enough to hold both a pointer to the allocated memory and a copy of the allocator, `allocated-ptr` shall allocate additional storage for the allocator.
## Example
```cpp
Expand Down
6 changes: 3 additions & 3 deletions docs/make_proxy_inplace.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ proxy<F> make_proxy_inplace(T&& value)
requires(inplace_proxiable_target<std::decay_t<T>, F>);
```
`(1)` Creates a `proxy<F>` object containing a `sbo-ptr<T>` direct-non-list-initialized with `std::forward<Args>(args)...`.
`(1)` Creates a `proxy<F>` object containing a value `p` of type `sbo-ptr<T>`, where `*p` is direct-non-list-initialized with `std::forward<Args>(args)...`.
`(2)` Creates a `proxy<F>` object containing a `sbo-ptr<T>` direct-non-list-initialized with `il, std::forward<Args>(args)...`.
`(2)` Creates a `proxy<F>` object containing a value `p` of type `sbo-ptr<T>`, where `*p` is direct-non-list-initialized with `il, std::forward<Args>(args)...`.
`(3)` Creates a `proxy<F>` object containing a `sbo-ptr<std::decay_t<T>>` direct-non-list-initialized with `std::forward<T>(value)`.
`(3)` Creates a `proxy<F>` object containing a value `p` of type `sbo-ptr<std::decay_t<T>>`, where `*p` is direct-non-list-initialized with `std::forward<T>(value)`.
## Return Value
Expand Down

0 comments on commit 40271e5

Please sign in to comment.