mirror of
https://github.com/charles-lunarg/vk-bootstrap.git
synced 2024-11-22 07:24:34 +00:00
Add missing copy/move assignment operators to vkb::Result
This commit is contained in:
parent
eeffeff409
commit
99e92599c2
@ -53,6 +53,13 @@ template <typename T> class Result {
|
|||||||
else
|
else
|
||||||
m_error = expected.m_error;
|
m_error = expected.m_error;
|
||||||
}
|
}
|
||||||
|
Result& operator=(Result const& result) {
|
||||||
|
m_init = result.m_init;
|
||||||
|
if (m_init)
|
||||||
|
new (&m_value) T{ result.m_value };
|
||||||
|
else
|
||||||
|
m_error = result.m_error;
|
||||||
|
}
|
||||||
Result(Result&& expected) : m_init(expected.m_init) {
|
Result(Result&& expected) : m_init(expected.m_init) {
|
||||||
if (m_init)
|
if (m_init)
|
||||||
new (&m_value) T{ std::move(expected.m_value) };
|
new (&m_value) T{ std::move(expected.m_value) };
|
||||||
@ -60,7 +67,13 @@ template <typename T> class Result {
|
|||||||
m_error = std::move(expected.m_error);
|
m_error = std::move(expected.m_error);
|
||||||
expected.destroy();
|
expected.destroy();
|
||||||
}
|
}
|
||||||
|
Result& operator=(Result&& result) {
|
||||||
|
m_init = result.m_init;
|
||||||
|
if (m_init)
|
||||||
|
new (&m_value) T{ std::move(result.m_value) };
|
||||||
|
else
|
||||||
|
m_error = std::move(result.m_error);
|
||||||
|
}
|
||||||
Result& operator=(const T& expect) {
|
Result& operator=(const T& expect) {
|
||||||
destroy();
|
destroy();
|
||||||
m_init = true;
|
m_init = true;
|
||||||
@ -309,8 +322,8 @@ class InstanceBuilder {
|
|||||||
// Require a vulkan instance API version. Will fail to create if this version isn't available.
|
// Require a vulkan instance API version. Will fail to create if this version isn't available.
|
||||||
InstanceBuilder& require_api_version(uint32_t major, uint32_t minor, uint32_t patch = 0);
|
InstanceBuilder& require_api_version(uint32_t major, uint32_t minor, uint32_t patch = 0);
|
||||||
|
|
||||||
// Prefer a vulkan instance API version. If the desired version isn't available, it will use the highest version available.
|
// Prefer a vulkan instance API version. If the desired version isn't available, it will use the
|
||||||
// Should be constructed with VK_MAKE_VERSION or VK_MAKE_API_VERSION.
|
// highest version available. Should be constructed with VK_MAKE_VERSION or VK_MAKE_API_VERSION.
|
||||||
InstanceBuilder& desire_api_version(uint32_t preferred_vulkan_version);
|
InstanceBuilder& desire_api_version(uint32_t preferred_vulkan_version);
|
||||||
// Prefer a vulkan instance API version. If the desired version isn't available, it will use the highest version available.
|
// Prefer a vulkan instance API version. If the desired version isn't available, it will use the highest version available.
|
||||||
InstanceBuilder& desire_api_version(uint32_t major, uint32_t minor, uint32_t patch = 0);
|
InstanceBuilder& desire_api_version(uint32_t major, uint32_t minor, uint32_t patch = 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user