use concepts instead of SFINAE
This commit is contained in:
@@ -75,11 +75,10 @@ struct NtSystemClock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// To convert XSystemClock to sys, do clock_cast<WinSystemTime>(tp) first
|
// To convert XSystemClock to sys, do clock_cast<WinSystemTime>(tp) first
|
||||||
// SFINAE hack https://stackoverflow.com/a/58813009
|
static constexpr std::chrono::system_clock::time_point to_sys(
|
||||||
template <Domain domain_fresh_ = domain_>
|
const time_point& tp)
|
||||||
static constexpr std::enable_if_t<domain_fresh_ == Domain::Host,
|
requires(domain_ == Domain::Host)
|
||||||
std::chrono::system_clock::time_point>
|
{
|
||||||
to_sys(const time_point& tp) {
|
|
||||||
using sys_duration = std::chrono::system_clock::duration;
|
using sys_duration = std::chrono::system_clock::duration;
|
||||||
using sys_time = std::chrono::system_clock::time_point;
|
using sys_time = std::chrono::system_clock::time_point;
|
||||||
|
|
||||||
@@ -91,17 +90,15 @@ struct NtSystemClock {
|
|||||||
|
|
||||||
// TODO(Gliniak): Disable until WINE will implement tzdb.
|
// TODO(Gliniak): Disable until WINE will implement tzdb.
|
||||||
/*
|
/*
|
||||||
template <Domain domain_fresh_ = domain_>
|
static constexpr std::chrono::local_time<std::chrono::system_clock::duration>
|
||||||
static constexpr std::enable_if_t<
|
to_local(const time_point& tp) requires (domain_ == Domain::Host) {
|
||||||
domain_fresh_ == Domain::Host,
|
|
||||||
std::chrono::local_time<std::chrono::system_clock::duration>>
|
|
||||||
to_local(const time_point& tp) {
|
|
||||||
return std::chrono::current_zone()->to_local(to_sys(tp));
|
return std::chrono::current_zone()->to_local(to_sys(tp));
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
template <Domain domain_fresh_ = domain_>
|
static constexpr time_point from_sys(
|
||||||
static constexpr std::enable_if_t<domain_fresh_ == Domain::Host, time_point>
|
const std::chrono::system_clock::time_point& tp)
|
||||||
from_sys(const std::chrono::system_clock::time_point& tp) {
|
requires(domain_ == Domain::Host)
|
||||||
|
{
|
||||||
auto ctp = std::chrono::time_point_cast<duration>(tp);
|
auto ctp = std::chrono::time_point_cast<duration>(tp);
|
||||||
auto dp = time_point{ctp.time_since_epoch()};
|
auto dp = time_point{ctp.time_since_epoch()};
|
||||||
dp -= unix_epoch_delta();
|
dp -= unix_epoch_delta();
|
||||||
|
|||||||
@@ -500,15 +500,16 @@ enum class KernelModuleId {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <size_t I = 0, typename... Ps>
|
template <size_t I = 0, typename... Ps>
|
||||||
typename std::enable_if<I == sizeof...(Ps)>::type AppendKernelCallParams(
|
requires(I == sizeof...(Ps))
|
||||||
StringBuffer& string_buffer, xe::cpu::Export* export_entry,
|
void AppendKernelCallParams(StringBuffer& string_buffer,
|
||||||
const std::tuple<Ps...>&) {}
|
xe::cpu::Export* export_entry,
|
||||||
|
const std::tuple<Ps...>&) {}
|
||||||
|
|
||||||
template <size_t I = 0, typename... Ps>
|
template <size_t I = 0, typename... Ps>
|
||||||
typename std::enable_if <
|
requires(I < sizeof...(Ps))
|
||||||
I<sizeof...(Ps)>::type AppendKernelCallParams(
|
void AppendKernelCallParams(StringBuffer& string_buffer,
|
||||||
StringBuffer& string_buffer, xe::cpu::Export* export_entry,
|
xe::cpu::Export* export_entry,
|
||||||
const std::tuple<Ps...>& params) {
|
const std::tuple<Ps...>& params) {
|
||||||
if (I) {
|
if (I) {
|
||||||
string_buffer.Append(", ");
|
string_buffer.Append(", ");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -286,8 +286,8 @@ class object_ref {
|
|||||||
reset(right.get());
|
reset(right.get());
|
||||||
if (value_) value_->Retain();
|
if (value_) value_->Retain();
|
||||||
}
|
}
|
||||||
template <class V, class = typename std::enable_if<
|
template <class V>
|
||||||
std::is_convertible<V*, T*>::value, void>::type>
|
requires std::is_convertible_v<V*, T*>
|
||||||
object_ref(const object_ref<V>& right) noexcept {
|
object_ref(const object_ref<V>& right) noexcept {
|
||||||
reset(right.get());
|
reset(right.get());
|
||||||
if (value_) value_->Retain();
|
if (value_) value_->Retain();
|
||||||
@@ -379,8 +379,8 @@ bool operator!=(std::nullptr_t _Left, const object_ref<_Ty>& _Right) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class T, class... Args>
|
template <class T, class... Args>
|
||||||
std::enable_if_t<!std::is_array<T>::value, object_ref<T>> make_object(
|
requires(!std::is_array_v<T>)
|
||||||
Args&&... args) {
|
object_ref<T> make_object(Args&&... args) {
|
||||||
return object_ref<T>(new T(std::forward<Args>(args)...));
|
return object_ref<T>(new T(std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user