Skip to content

Commit

Permalink
Add some more implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
jbcoe committed Jun 29, 2024
1 parent c12188e commit 037f385
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions TALK.md
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ No change to remaining member function interfaces.
// ...
template <typename... Us>
static pointer construct_from(A alloc, Us&&... us) {
static pointer construct(A alloc, Us&&... us) {
pointer mem = allocator_traits::allocate(alloc, 1);
try {
allocator_traits::construct(alloc, std::to_address(mem),
Expand All @@ -513,7 +513,7 @@ No change to remaining member function interfaces.

// ...

constexpr static void destroy_with(A alloc, pointer p) {
constexpr static void destroy(A alloc, pointer p) {
allocator_traits::destroy(alloc, std::to_address(p));
allocator_traits::deallocate(alloc, p, 1);
}
Expand All @@ -526,6 +526,12 @@ No change to remaining member function interfaces.
Use the allocator-construction helper in constructors
```cpp
dyn_optional() noexcept
: allocator(), ptr(construct(allocator)) {}
template <typename ...Us>
dyn_optional(Us&& ...us) noexcept
: allocator(), ptr(construct(allocator, std::forward<Us>(us)...)) {}
```

---
Expand All @@ -535,6 +541,12 @@ Use the allocator-construction helper in constructors
Use the allocator-construction helper in allocator-extended constructors

```cpp
dyn_optional(std::allocator_arg_t, const A& alloc) noexcept
: allocator(alloc), ptr(construct(allocator)) {}

template <typename ...Us>
dyn_optional(std::allocator_arg_t, const A& alloc, Us&& ...us) noexcept
: allocator(alloc), ptr(construct(allocator, std::forward<Us>(us)...)) {}
```
---
Expand All @@ -543,6 +555,8 @@ Use the allocator-construction helper in allocator-extended constructors
Use the allocator-construction helper in copy and move constructors
Use `select_on_container_copy_construction` to copy (or not) the allocator.
```cpp
```

Expand Down

0 comments on commit 037f385

Please sign in to comment.