ipc: Allow all trivially copyable objects to be passed directly into WriteBuffer

With the support of C++20, we can use concepts to deduce if a type is an STL container or not.
This commit is contained in:
David Marcec
2020-08-03 17:44:41 +10:00
parent 0c262f8ac2
commit 31b05ae92b
11 changed files with 46 additions and 27 deletions

18
src/common/concepts.h Normal file
View File

@@ -0,0 +1,18 @@
// Copyright 2020 yuzu emulator team
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <concepts>
// Check if type is like an STL container
template <typename T>
concept IsSTLContainer = requires(T t) {
typename T::value_type;
// TODO(ogniK): Replace below is std::same_as<void> when MSVC supports it.
t.begin();
t.end();
t.data();
t.size();
};