mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-12-25 01:01:37 -05:00
Common: Replace enable_if with concepts and other minor modernizations.
This commit is contained in:
@@ -3,26 +3,25 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include <SFML/Network/Packet.hpp>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/Swap.h"
|
||||
#include "Common/TypeUtils.h"
|
||||
|
||||
sf::Packet& operator>>(sf::Packet& packet, Common::BigEndianValue<u16>& data);
|
||||
sf::Packet& operator>>(sf::Packet& packet, Common::BigEndianValue<u32>& data);
|
||||
sf::Packet& operator>>(sf::Packet& packet, Common::BigEndianValue<u64>& data);
|
||||
|
||||
template <typename Enum, std::enable_if_t<std::is_enum_v<Enum>>* = nullptr>
|
||||
template <Common::Enum Enum>
|
||||
sf::Packet& operator<<(sf::Packet& packet, Enum e)
|
||||
{
|
||||
using Underlying = std::underlying_type_t<Enum>;
|
||||
packet << static_cast<Underlying>(e);
|
||||
packet << Common::ToUnderlying(e);
|
||||
return packet;
|
||||
}
|
||||
|
||||
template <typename Enum, std::enable_if_t<std::is_enum_v<Enum>>* = nullptr>
|
||||
template <Common::Enum Enum>
|
||||
sf::Packet& operator>>(sf::Packet& packet, Enum& e)
|
||||
{
|
||||
using Underlying = std::underlying_type_t<Enum>;
|
||||
|
||||
Reference in New Issue
Block a user