mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-28 13:28:01 +03:00
concepts: fix review notes
Some checks are pending
Some checks are pending
This commit is contained in:
parent
ebde5310b9
commit
29ad4ecc78
6 changed files with 23 additions and 19 deletions
|
@ -1,5 +1,6 @@
|
||||||
#pragma once // No BOM and only basic ASCII in this header, or a neko will die
|
#pragma once // No BOM and only basic ASCII in this header, or a neko will die
|
||||||
|
|
||||||
|
#include "util/serialization.hpp"
|
||||||
#include "util/types.hpp"
|
#include "util/types.hpp"
|
||||||
#include "util/shared_ptr.hpp"
|
#include "util/shared_ptr.hpp"
|
||||||
#include "bit_set.h"
|
#include "bit_set.h"
|
||||||
|
@ -78,6 +79,8 @@ namespace fs
|
||||||
constexpr bool operator==(const stat_t&) const = default;
|
constexpr bool operator==(const stat_t&) const = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static_assert(utils::Bitcopy<stat_t>);
|
||||||
|
|
||||||
// Helper, layout is equal to iovec struct
|
// Helper, layout is equal to iovec struct
|
||||||
struct iovec_clone
|
struct iovec_clone
|
||||||
{
|
{
|
||||||
|
@ -126,6 +129,8 @@ namespace fs
|
||||||
using enable_bitcopy = std::false_type;
|
using enable_bitcopy = std::false_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static_assert(!utils::Bitcopy<dir_entry>);
|
||||||
|
|
||||||
// Directory handle base
|
// Directory handle base
|
||||||
struct dir_base
|
struct dir_base
|
||||||
{
|
{
|
||||||
|
|
|
@ -130,7 +130,7 @@ struct fmt_unveil<se_t<T, Se, Align>>
|
||||||
};
|
};
|
||||||
|
|
||||||
// String type format provider, also type classifier (format() called if an argument is formatted as "%s")
|
// String type format provider, also type classifier (format() called if an argument is formatted as "%s")
|
||||||
template <typename T, typename = void>
|
template <typename T>
|
||||||
struct fmt_class_string
|
struct fmt_class_string
|
||||||
{
|
{
|
||||||
// Formatting function (must be explicitly specialized)
|
// Formatting function (must be explicitly specialized)
|
||||||
|
@ -215,7 +215,7 @@ struct fmt_class_string<T*> : fmt_class_string<const void*>
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct fmt_class_string<const char*, void>
|
struct fmt_class_string<const char*>
|
||||||
{
|
{
|
||||||
static void format(std::string& out, u64 arg);
|
static void format(std::string& out, u64 arg);
|
||||||
};
|
};
|
||||||
|
@ -237,7 +237,7 @@ struct fmt_class_string<char8_t*> : fmt_class_string<const char8_t*>
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct fmt_class_string<const wchar_t*, void>
|
struct fmt_class_string<const wchar_t*>
|
||||||
{
|
{
|
||||||
static void format(std::string& out, u64 arg);
|
static void format(std::string& out, u64 arg);
|
||||||
};
|
};
|
||||||
|
@ -257,7 +257,7 @@ namespace fmt
|
||||||
}
|
}
|
||||||
|
|
||||||
template <fmt::StringConvertible T>
|
template <fmt::StringConvertible T>
|
||||||
struct fmt_class_string<T, void>
|
struct fmt_class_string<T>
|
||||||
{
|
{
|
||||||
static FORCE_INLINE SAFE_BUFFERS(const T&) get_object(u64 arg)
|
static FORCE_INLINE SAFE_BUFFERS(const T&) get_object(u64 arg)
|
||||||
{
|
{
|
||||||
|
@ -278,7 +278,7 @@ namespace fmt
|
||||||
}
|
}
|
||||||
|
|
||||||
template <fmt::ByteArray T>
|
template <fmt::ByteArray T>
|
||||||
struct fmt_class_string<T, void>
|
struct fmt_class_string<T>
|
||||||
{
|
{
|
||||||
static FORCE_INLINE SAFE_BUFFERS(const T&) get_object(u64 arg)
|
static FORCE_INLINE SAFE_BUFFERS(const T&) get_object(u64 arg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "Emu/Memory/vm_ptr.h"
|
||||||
#include "cellVpost.h"
|
#include "cellVpost.h"
|
||||||
|
|
||||||
// Error Codes
|
// Error Codes
|
||||||
|
|
|
@ -441,37 +441,37 @@ struct fmt_unveil<vm::_ptr_base<T, AT>>
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct fmt_class_string<vm::_ptr_base<const void, u32>, void>
|
struct fmt_class_string<vm::_ptr_base<const void, u32>>
|
||||||
{
|
{
|
||||||
static void format(std::string& out, u64 arg);
|
static void format(std::string& out, u64 arg);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct fmt_class_string<vm::_ptr_base<T, u32>, void> : fmt_class_string<vm::_ptr_base<const void, u32>, void>
|
struct fmt_class_string<vm::_ptr_base<T, u32>> : fmt_class_string<vm::_ptr_base<const void, u32>>
|
||||||
{
|
{
|
||||||
// Classify all pointers as const void*
|
// Classify all pointers as const void*
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct fmt_class_string<vm::_ptr_base<const char, u32>, void>
|
struct fmt_class_string<vm::_ptr_base<const char, u32>>
|
||||||
{
|
{
|
||||||
static void format(std::string& out, u64 arg);
|
static void format(std::string& out, u64 arg);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct fmt_class_string<vm::_ptr_base<char, u32>, void> : fmt_class_string<vm::_ptr_base<const char, u32>>
|
struct fmt_class_string<vm::_ptr_base<char, u32>> : fmt_class_string<vm::_ptr_base<const char, u32>>
|
||||||
{
|
{
|
||||||
// Classify char* as const char*
|
// Classify char* as const char*
|
||||||
};
|
};
|
||||||
|
|
||||||
template <usz Size>
|
template <usz Size>
|
||||||
struct fmt_class_string<vm::_ptr_base<const char[Size], u32>, void> : fmt_class_string<vm::_ptr_base<const char, u32>>
|
struct fmt_class_string<vm::_ptr_base<const char[Size], u32>> : fmt_class_string<vm::_ptr_base<const char, u32>>
|
||||||
{
|
{
|
||||||
// Classify const char[] as const char*
|
// Classify const char[] as const char*
|
||||||
};
|
};
|
||||||
|
|
||||||
template <usz Size>
|
template <usz Size>
|
||||||
struct fmt_class_string<vm::_ptr_base<char[Size], u32>, void> : fmt_class_string<vm::_ptr_base<const char, u32>>
|
struct fmt_class_string<vm::_ptr_base<char[Size], u32>> : fmt_class_string<vm::_ptr_base<const char, u32>>
|
||||||
{
|
{
|
||||||
// Classify char[] as const char*
|
// Classify char[] as const char*
|
||||||
};
|
};
|
||||||
|
|
|
@ -144,7 +144,7 @@ namespace stx
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
requires requires(T& a, utils::serial& ar) { a.save(ar); }
|
requires requires(T& a, utils::serial& ar) { a.save(stx::exact_t<utils::serial&>(ar)); }
|
||||||
static void call_save(void* ptr, utils::serial& ar) noexcept
|
static void call_save(void* ptr, utils::serial& ar) noexcept
|
||||||
{
|
{
|
||||||
std::launder(static_cast<T*>(ptr))->save(stx::exact_t<utils::serial&>(ar));
|
std::launder(static_cast<T*>(ptr))->save(stx::exact_t<utils::serial&>(ar));
|
||||||
|
@ -170,7 +170,7 @@ namespace stx
|
||||||
r.thread_op = &call_thread_op<T>;
|
r.thread_op = &call_thread_op<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if constexpr (!!(requires(T& a, utils::serial& ar) { a.save(ar); }))
|
if constexpr (!!(requires(T& a, utils::serial& ar) { a.save(stx::exact_t<utils::serial&>(ar)); }))
|
||||||
{
|
{
|
||||||
r.save = &call_save<T>;
|
r.save = &call_save<T>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,7 @@ namespace utils
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept Bitcopy = (std::is_arithmetic_v<T>) || (std::is_enum_v<T>) || Integral<T> || requires() {
|
concept Bitcopy = (std::is_arithmetic_v<T>) || (std::is_enum_v<T>) || Integral<T> || typename T::enable_bitcopy()();
|
||||||
typename T::enable_bitcopy;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept TupleAlike = (!FastRandomAccess<T>) && requires ()
|
concept TupleAlike = (!FastRandomAccess<T>) && requires ()
|
||||||
|
@ -29,8 +27,8 @@ namespace utils
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept ListAlike = requires(std::remove_cvref_t<T>& obj, T::value_type item) { obj.insert(obj.end(), item); };
|
|
||||||
|
|
||||||
|
concept ListAlike = requires(std::remove_cvref_t<T>& obj, T::value_type item) { obj.insert(obj.end(), std::move(item)); };
|
||||||
struct serial;
|
struct serial;
|
||||||
|
|
||||||
struct serialization_file_handler
|
struct serialization_file_handler
|
||||||
|
@ -427,7 +425,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
requires requires(T& obj, utils::serial& ar) { (obj.*(&T::operator()))(ar); }
|
requires requires(T& obj, utils::serial& ar) { (obj.*(&T::operator()))(stx::exact_t<utils::serial&>(ar)); }
|
||||||
bool serialize(T& obj)
|
bool serialize(T& obj)
|
||||||
{
|
{
|
||||||
obj(*this);
|
obj(*this);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue