Remove explicit_bool_t, ignore, multicast<>

Remove vm::ptr operator %
This was a bad idea but explicit_bool_t was created almost for it
Other removed types are unused and have little to no meaning
This commit is contained in:
Nekotekina 2018-09-05 16:24:11 +03:00
parent 99ffc3fca9
commit ee96807305
11 changed files with 22 additions and 91 deletions

View file

@ -185,7 +185,7 @@ u32 notifier::imp_notify(u32 count)
});
}
explicit_bool_t notifier::wait(u64 usec_timeout)
bool notifier::wait(u64 usec_timeout)
{
const u32 _old = m_cond.m_value.fetch_add(1);

View file

@ -23,7 +23,7 @@ public:
// Intrusive wait algorithm for lockable objects
template <typename T>
explicit_bool_t wait(T& object, u64 usec_timeout = -1)
bool wait(T& object, u64 usec_timeout = -1)
{
const u32 _old = m_value.fetch_add(1); // Increment waiter counter
object.unlock();
@ -88,7 +88,7 @@ public:
imp_unlock(1);
}
explicit_bool_t wait(u64 usec_timeout = -1);
bool wait(u64 usec_timeout = -1);
void notify_all()
{

View file

@ -71,7 +71,7 @@ public:
}
// Conditionally set state (optimized)
explicit_bool_t state_test_and_set(T expected, T state)
bool state_test_and_set(T expected, T state)
{
if (m_value == expected && m_value.compare_and_swap_test(expected, state))
{
@ -83,7 +83,7 @@ public:
}
// Conditionally set state (list version)
explicit_bool_t state_test_and_set(std::initializer_list<T> expected, T state)
bool state_test_and_set(std::initializer_list<T> expected, T state)
{
T _old;

View file

@ -112,10 +112,6 @@ class se_t;
template <typename T>
class atomic_t;
#if defined(__INTELLISENSE__) && !defined(_MSC_VER)
namespace std { template <typename...> using void_t = void; }
#endif
// Extract T::simple_type if available, remove cv qualifiers
template <typename T, typename = void>
struct simple_type_helper
@ -151,22 +147,6 @@ public:
}
};
// Bool wrapper for restricting bool result conversions
struct explicit_bool_t
{
const bool value;
constexpr explicit_bool_t(bool value)
: value(value)
{
}
explicit constexpr operator bool() const
{
return value;
}
};
#ifndef _MSC_VER
using u128 = __uint128_t;
using s128 = __int128_t;
@ -382,14 +362,6 @@ CHECK_SIZE_ALIGN(f16, 2, 2);
using f32 = float;
using f64 = double;
struct ignore
{
template <typename T>
ignore(T)
{
}
};
template <typename T, typename = std::enable_if_t<std::is_integral<T>::value>>
constexpr T align(const T& value, ullong align)
{
@ -811,35 +783,6 @@ struct cmd64 : any64
static_assert(sizeof(cmd64) == 8 && std::is_pod<cmd64>::value, "Incorrect cmd64 type");
// Allows to define integer convertible to multiple types
template <typename T, T Value, typename T1 = void, typename... Ts>
struct multicast : multicast<T, Value, Ts...>
{
constexpr multicast()
: multicast<T, Value, Ts...>()
{
}
// Implicit conversion to desired type
constexpr operator T1() const
{
return static_cast<T1>(Value);
}
};
// Recursion terminator
template <typename T, T Value>
struct multicast<T, Value, void>
{
constexpr multicast() = default;
// Explicit conversion to base type
explicit constexpr operator T() const
{
return Value;
}
};
// Error code type (return type), implements error reporting. Could be a template.
struct error_code
{