mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-03-12 06:39:14 +01:00
Common: Create Range Projections For std::pair
This commit is contained in:
parent
b8921b1338
commit
d77e0c665c
@ -113,6 +113,7 @@ add_library(common
|
||||
PcapFile.h
|
||||
Profiler.cpp
|
||||
Profiler.h
|
||||
Projection.h
|
||||
QoSSession.cpp
|
||||
QoSSession.h
|
||||
Random.cpp
|
||||
|
30
Source/Core/Common/Projection.h
Normal file
30
Source/Core/Common/Projection.h
Normal file
@ -0,0 +1,30 @@
|
||||
// Copyright 2025 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace Common::Projection
|
||||
{
|
||||
struct First
|
||||
{
|
||||
// TODO C++23: static operator()
|
||||
template <class T>
|
||||
[[nodiscard]] constexpr auto&& operator()(T&& t) const noexcept
|
||||
{
|
||||
return std::forward<T>(t).first;
|
||||
}
|
||||
};
|
||||
|
||||
struct Second
|
||||
{
|
||||
// TODO C++23: static operator()
|
||||
template <class T>
|
||||
[[nodiscard]] constexpr auto&& operator()(T&& t) const noexcept
|
||||
{
|
||||
return std::forward<T>(t).second;
|
||||
}
|
||||
};
|
||||
|
||||
using Key = First;
|
||||
using Value = Second;
|
||||
} // namespace Common::Projection
|
@ -143,6 +143,7 @@
|
||||
<ClInclude Include="Common\Network.h" />
|
||||
<ClInclude Include="Common\PcapFile.h" />
|
||||
<ClInclude Include="Common\Profiler.h" />
|
||||
<ClInclude Include="Common\Projection.h" />
|
||||
<ClInclude Include="Common\QoSSession.h" />
|
||||
<ClInclude Include="Common\Random.h" />
|
||||
<ClInclude Include="Common\Result.h" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user