Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow destructuring of ResultValue with std::tie #1882

Open
HildarTheDorf opened this issue May 30, 2024 · 2 comments
Open

Allow destructuring of ResultValue with std::tie #1882

HildarTheDorf opened this issue May 30, 2024 · 2 comments

Comments

@HildarTheDorf
Copy link

HildarTheDorf commented May 30, 2024

Currently it is possible to do the following as ResultValue<T> provides a cast operator to std::tuple<vk:Result, T>:
const auto [acquireResult, imageIndex] = _device->acquireNextImageKHR(...);.

I would like to be able to do this: std::tie(std::ignore, _imageIndex) = _device->acquireNextImageKHR(...);1 however it currently fails to compile.

As a work around I either have to static_cast the ResultValue to std::tuple, or write a helper function that does such. Would it be possible to alter vk::ResultValue to allow this implicitly?

Footnotes

  1. Note that the actual usefulness of ignoring the result of vkAcquireNextImageKHR is beyond the scope of this issue.

@qbojj
Copy link
Contributor

qbojj commented Jul 11, 2024

@xbohdan
Copy link
Contributor

xbohdan commented Aug 6, 2024

std::tie(result, backBufferIndex) = swapchainData.swapchain.acquireNextImage(...) is an actual snippet from my C++20 sample... std::ignore works in place of result as well. I'm using Vulkan SDK 1.3.280.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants