Hi Thiago,

Thanks for your reply. I think you missed that one key functionality here is to allow a runtime number of each "T".

Going back to the example of std::make_shared<int[]>, I would be able to create the control block + "n" ints with:

auto objs = make_contiguous_objects<ControlBlock, int>(1, n);

Best Regards,
Breno Guimarães



On Mon, Apr 25, 2022 at 8:38 PM Thiago Macieira via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
On Monday, 25 April 2022 16:23:37 PDT Breno Guimarães via Std-Proposals wrote:
> template<class... Ts>
> std::tuple<std::pair<Ts*, Ts*>...>
> make_contiguous_objects(initializer_for<Ts>...);

std::tuple is already your answer.

If you're going to leave the layout to the implementation, then it means you
don't care about exact offsets inside the allocated memory. That means
std::tuple with its empty base optimisations and support for final does what
you want it to do.

You don't need make_contiguous_objects<T...>(). All you need is
std::tuple<T...>.

--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DPG Cloud Engineering



--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals