Created on 2017-08-06.00:00:00 last changed 45 months ago
Proposed resolution:
This resolution is relative to N4687.
Edit [util.smartptr.shared.create] as indicated:
template<class T, ...> shared_ptr<T> make_shared(args); template<class T, class A, ...> shared_ptr<T> allocate_shared(const A& a, args);[…]
-7- Remarks:
[…]
(7.5) — When a (sub)object of a non-array type U is specified to have an initial value of v, or U(l...), where l... is a list of constructor arguments, allocate_shared shall initialize this (sub)object via the expression
(7.5.1) — allocator_traits<A2>::construct(a2, pv, v) or
(7.5.2) — allocator_traits<A2>::construct(a2, pv, l...)
respectively, where pv points to storage suitable to hold an object of type U and a2 of type A2 is a rebound copy of the allocator a passed to allocate_shared such that its value_type is remove_cv_t<U>.
(7.6) — When a (sub)object of non-array type U is specified to have a default initial value, make_shared shall initialize this (sub)object via the expression ::new(pv) U(), where pv has type void* and points to storage suitable to hold an object of type U.
(7.7) — When a (sub)object of non-array type U is specified to have a default initial value, allocate_shared shall initialize this (sub)object via the expression allocator_traits<A2>::construct(a2, pv), where pv points to storage suitable to hold an object of type U and a2 of type A2 is a rebound copy of the allocator a passed to allocate_shared such that its value_type is remove_cv_t<U>.
[…]
[ 2018-3-17 Adopted in Jacksonville ]
[ 2017-11-01 Moved to Tentatively Ready after 6 positive votes for P0 on c++std-lib. ]
The remarks for the allocate_shared family of functions specify that when constructing a (sub)object of type U, it uses a rebound copy of the allocator a passed to allocate_shared such that its value_type is U. However U can be a const or volatile qualified type, and [allocator.requirements] specify that the value_type must be cv-unqualified.
History | |||
---|---|---|---|
Date | User | Action | Args |
2021-02-25 10:48:01 | admin | set | status: wp -> c++20 |
2018-03-18 16:03:30 | admin | set | messages: + msg9737 |
2018-03-18 16:03:30 | admin | set | status: voting -> wp |
2018-02-12 01:13:49 | admin | set | status: ready -> voting |
2017-11-01 19:02:49 | admin | set | messages: + msg9496 |
2017-11-01 19:02:49 | admin | set | status: new -> ready |
2017-08-06 17:36:51 | admin | set | messages: + msg9440 |
2017-08-06 00:00:00 | admin | create |