Date: Sat, 18 Mar 2023 10:26:29 +0100
On 13/03/2023 00.34, Breno GuimarĂ£es via Std-Proposals wrote:
> Gosh, I'll have to rewrite a lot of the library to add _proper_ allocator support.
What do you mean? Does libc++ not correctly interact with the allocator?
General remark on the proposal: It seems it delivers useful functionality
for the case "allocate memory for these arrays, with proper alignment".
Having that in a non-RAII wrapper as the lowest-level interface seems
plausible (there are no destructors to call at that level), and
allocator-style functions don't give you RAII, in general.
This also removes all the std::arg business from the interface surface.
Would an interface like
template<class ... Ts>
std::tuple<Ts * ...> allocate_arrays( decltype(std::void_t<Ts>, std::size_t>)... );
help most of the use-cases? If someone wants construction,
the std::uninitialized_* algorithms are at their service.
(The std::uninitialized_* algorithms seem to deal in pointers-to-T
even when pointing to not-yet-constructed memory.)
Jens
> Gosh, I'll have to rewrite a lot of the library to add _proper_ allocator support.
What do you mean? Does libc++ not correctly interact with the allocator?
General remark on the proposal: It seems it delivers useful functionality
for the case "allocate memory for these arrays, with proper alignment".
Having that in a non-RAII wrapper as the lowest-level interface seems
plausible (there are no destructors to call at that level), and
allocator-style functions don't give you RAII, in general.
This also removes all the std::arg business from the interface surface.
Would an interface like
template<class ... Ts>
std::tuple<Ts * ...> allocate_arrays( decltype(std::void_t<Ts>, std::size_t>)... );
help most of the use-cases? If someone wants construction,
the std::uninitialized_* algorithms are at their service.
(The std::uninitialized_* algorithms seem to deal in pointers-to-T
even when pointing to not-yet-constructed memory.)
Jens
Received on 2023-03-18 09:26:33