Skip to content

Commit

Permalink
Dereference iterator using std::addressof.
Browse files Browse the repository at this point in the history
  • Loading branch information
crud89 committed Nov 7, 2024
1 parent ce21290 commit 5ed7f87
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Backends/DirectX12/src/render_pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ class DirectX12RenderPass::DirectX12RenderPassImpl : public Implement<DirectX12R
std::ranges::sort(m_renderTargets, [this](const auto& a, const auto& b) { return a.location() < b.location(); });

if (auto match = std::ranges::find_if(m_renderTargets, [](const RenderTarget& renderTarget) { return renderTarget.type() == RenderTargetType::Present; }); match != m_renderTargets.end())
m_presentTarget = match._Ptr;
m_presentTarget = std::addressof(*match);
else
m_presentTarget = nullptr;

if (auto match = std::ranges::find_if(m_renderTargets, [](const RenderTarget& renderTarget) { return renderTarget.type() == RenderTargetType::DepthStencil; }); match != m_renderTargets.end())
m_depthStencilTarget = match._Ptr;
m_depthStencilTarget = std::addressof(*match);
else
m_depthStencilTarget = nullptr;

Expand Down
4 changes: 2 additions & 2 deletions src/Backends/Vulkan/src/render_pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ class VulkanRenderPass::VulkanRenderPassImpl : public Implement<VulkanRenderPass
std::ranges::sort(m_renderTargets, [this](const auto& a, const auto& b) { return a.location() < b.location(); });

if (auto match = std::ranges::find_if(m_renderTargets, [](const RenderTarget& renderTarget) { return renderTarget.type() == RenderTargetType::Present; }); match != m_renderTargets.end())
m_presentTarget = &*match;
m_presentTarget = std::addressof(*match);
else
m_presentTarget = nullptr;

if (auto match = std::ranges::find_if(m_renderTargets, [](const RenderTarget& renderTarget) { return renderTarget.type() == RenderTargetType::DepthStencil; }); match != m_renderTargets.end())
m_depthStencilTarget = &*match;
m_depthStencilTarget = std::addressof(*match);
else
m_depthStencilTarget = nullptr;

Expand Down

0 comments on commit 5ed7f87

Please sign in to comment.