diff --git a/DRAFT.md b/DRAFT.md index 25e01a3f..ba6fd3b9 100644 --- a/DRAFT.md +++ b/DRAFT.md @@ -49,6 +49,9 @@ should not be considered in isolation. * Require `T` to satisfy the requirements of `Cpp17Destructible`. +* Rename exposition only variables `p_` to `p` and `allocator_` to `alloc`. + + ### Changes in R3 * Add explicit to constructors. @@ -532,8 +535,6 @@ move assignment, or swapping of the allocator only if ```c++ template > class indirect { - pointer p_; // exposition only - Allocator allocator_; // exposition only public: using value_type = T; using allocator_type = Allocator; @@ -670,6 +671,10 @@ class indirect { template friend constexpr auto operator<=>( const U& lhs, const indirect& rhs) noexcept(see below); + +private: + pointer p; // exposition only + Allocator alloc; // exposition only }; template @@ -689,7 +694,7 @@ explicit constexpr indirect() 1. _Mandates_: `is_default_constructible_v` is true. 2. _Effects_: Constructs an `indirect` owning a default constructed `T` - and stores the address in `p_`. `allocator_` is default constructed. + and stores the address in `p`. `alloc` is default constructed. 3. _Postconditions_: `*this` is not valueless. @@ -703,7 +708,7 @@ explicit constexpr indirect(allocator_arg_t, const Allocator& alloc); 5. _Mandates_: `is_default_constructible_v` is `true`. 6. _Effects_: Constructs an `indirect` owning a default constructed `T` and - stores the address in `p_`. `allocator_` is direct-non-list-initialized with `alloc`. + stores the address in `p`. `alloc` is direct-non-list-initialized with `alloc`. 7. _Postconditions_: `*this` is not valueless. @@ -723,13 +728,13 @@ explicit constexpr indirect(U&& u, Us&&... us); ```c++ template -explicit constexpr indirect(allocator_arg_t, const Allocator& alloc, U&& u, Us&& ...us); +explicit constexpr indirect(allocator_arg_t, const Allocator& a, U&& u, Us&& ...us); ``` 11. _Constraints_: `is_constructible_v` is `true`. `is_same_v, indirect>` is `false`. -12. _Effects_: `allocator_` is direct-non-list-initialized with `alloc`. +12. _Effects_: `alloc` is direct-non-list-initialized with `a`. DRAFTING NOTE: based on https://eel.is/c++draft/func.wrap#func.con-6 @@ -770,7 +775,7 @@ constexpr indirect(indirect&& other) noexcept; is `true` --end note]_ 23. _Effects_: Constructs an `indirect` that takes ownership of the `other`'s owned object and stores the address in `p_`. - `allocator_` is initialized by construction from `other.allocator_`. + `alloc` is initialized by construction from `other.alloc`. 24. _Postconditions_: `other` is valueless. @@ -811,12 +816,12 @@ constexpr indirect& operator=(const indirect& other); Otherwise, if either: - `is_copy_assignable_v` is `false` and `is_nothrow_copy_constructible_v` is `false`, or - `allocator_traits::propagate_on_container_copy_assignment::value` is `true` and - `allocator_ == other.allocator_` is `false`, or + `alloc == other.alloc` is `false`, or - `*this` is valueless - then, equivalent to `*this = indirect(allocator_arg, allocator_traits::propagate_on_container_copy_assignment::value ? other.allocator_ : allocator_, *other)` + then, equivalent to `*this = indirect(allocator_arg, allocator_traits::propagate_on_container_copy_assignment::value ? other.alloc : alloc, *other)` Otherwise, if `is_copy_assignable_v` is `true`, then equivalent to `**this = *other`, Otherwise, equivalent to: - - `(allocator_traits::destruct(alloc_, p_), allocator_traits::construct(alloc_, p_, *other))` + - `(allocator_traits::destruct(alloc, p), allocator_traits::construct(a, p, *other))` 4. _Postconditions_: `*this` is not valueless. @@ -834,7 +839,7 @@ _Mandates_: `is_move_constructible_v` is `true`. 7. _Effects_: If `&other == this`, then has no effects. Otherwise, if `allocator_traits::propagate_on_container_move_assignment::value - == true`, `allocator_` is set to the allocator of `other`. If allocator is + == true`, `alloc` is set to the allocator of `other`. If allocator is propagated or is equal to the allocator of `other`, destroys the owned object, if any, then takes ownership of the object owned by `other`. Otherwise, destroys the owned object if any, then move constructs an object from the @@ -1162,7 +1167,7 @@ operation. ```c++ template > class polymorphic { - Allocator allocator_; // exposition only + Allocator alloc; // exposition only public: using value_type = T; using allocator_type = Allocator; @@ -1225,7 +1230,7 @@ explicit constexpr polymorphic() `is_copy_constructible_v` is `true`. 2. _Effects_: Constructs a polymorphic owning a default constructed `T`. - `allocator_` is default constructed. + `alloc` is default constructed. 3. _Postconditions_: `*this` is not valueless. @@ -1240,7 +1245,7 @@ explicit constexpr polymorphic(allocator_arg_t, const Allocator& alloc); `is_copy_constructible_v` is `true`. 6. _Effects_: Constructs a polymorphic owning a default constructed `T`. - `allocator_` is direct-non-list-initialized with alloc. + `alloc` is direct-non-list-initialized with alloc. 7. _Postconditions_: `*this` is not valueless. @@ -1256,14 +1261,14 @@ explicit constexpr polymorphic(in_place_type_t, Ts&&... ts); ```c++ template -explicit constexpr polymorphic(allocator_arg_t, const Allocator& alloc, +explicit constexpr polymorphic(allocator_arg_t, const Allocator& a, in_place_type_t, Ts&&... ts); ``` 10. _Constraints_: `is_base_of_v` is `true` and `is_constructible_v` is `true` and `is_copy_constructible_v` is `true`. -11. _Effects_: `allocator_` is direct-non-list-initialized with alloc. +11. _Effects_: `alloc` is direct-non-list-initialized with `a`. 12. _Postconditions_: `*this` is not valueless. The owned instance targets an object of type `U` constructed with `std::forward(ts)...`. @@ -1273,17 +1278,17 @@ constexpr polymorphic(const polymorphic& other); ``` 13. _Effects_: Equivalent to - `polymorphic(allocator_arg_t{}, allocator_traits::select_on_container_copy_construction(other.alloc_), other)`. + `polymorphic(allocator_arg_t{}, allocator_traits::select_on_container_copy_construction(other.alloc), other)`. ```c++ -constexpr polymorphic(allocator_arg_t, const Allocator& alloc, +constexpr polymorphic(allocator_arg_t, const Allocator& a, const polymorphic& other); ``` 14. _Preconditions_: `other` is not valueless. 15. _Effects_: Constructs a polymorphic owning an instance of `T` created with the - copy constructor of the object owned by `other`. `allocator_` is direct-non-list-initialized with alloc. + copy constructor of the object owned by `other`. `alloc` is direct-non-list-initialized with `a`. 16. _Postconditions_: `*this` is not valueless. @@ -1294,7 +1299,7 @@ constexpr polymorphic(polymorphic&& other) noexcept; 17. _Effects_: Equivalent to `polymorphic(allocator_arg_t{}, Allocator(std::move(other.alloc_)), other)`. ```c++ -constexpr polymorphic(allocator_arg_t, const Allocator& alloc, +constexpr polymorphic(allocator_arg_t, const Allocator& a, polymorphic&& other) noexcept; ``` @@ -1303,7 +1308,7 @@ constexpr polymorphic(allocator_arg_t, const Allocator& alloc, 19. _Effects_: Constructs a polymorphic that takes ownership of the object owned by `other`. - `allocator_` is direct-non-list-initialized with `alloc`. + `alloc` is direct-non-list-initialized with `a`. 20. _Postconditions_: `other` is valueless.