C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] P2174 Status (and a tenuous offer to help)

From: Jens Maurer <Jens.Maurer_at_[hidden]>
Date: Thu, 13 May 2021 17:00:22 +0200
On 13/05/2021 00.54, Charlie Barto via Liaison wrote:
> Does the proposal work for:
>
> VkInstance instance = 0;
>     VkInstanceCreateInfo info {
>         .sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
> .pApplicationInfo = (VkApplicationInfo[]) {{
> .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
> .pApplicationName = "Hello World",
>        .applicationVersion = VK_MAKE_VERSION(0, 1, 0),
>             .pEngineName = "No Engine",
>             .apiVersion = VK_API_VERSION_1_2
>         };
>     VkResult result = vkCreateInstance(&info, nullptr, &instance);

The temporary arrays are not lifetime-extended in C++, so this
presumably would not work.

We could, however, establish "pointee lifetime extension"
similar to "bound-to-reference" lifetime extension.

Jens


Received on 2021-05-13 10:00:33