mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Common: Create Range Projections For std::pair
This commit is contained in:
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
|
Reference in New Issue
Block a user