minor changes
This commit is contained in:
parent
e39410607a
commit
ea93560c7c
@ -34,6 +34,9 @@ struct Event: BaseEvent {
|
||||
struct ErrorEvent: Event<ErrorEvent> {
|
||||
explicit ErrorEvent(int code = 0) noexcept: ec(code) { }
|
||||
|
||||
template<typename U, typename = std::enable_if_t<std::is_convertible<U, int>::value>>
|
||||
explicit ErrorEvent(U val) noexcept: ec{static_cast<int>(val)} { }
|
||||
|
||||
const char * what() const noexcept { return uv_strerror(ec); }
|
||||
int code() const noexcept { return ec; }
|
||||
|
||||
|
||||
@ -30,9 +30,7 @@ class TTY final: public Stream<TTY, uv_tty_t> {
|
||||
explicit TTY(std::shared_ptr<Loop> ref,
|
||||
FileHandle desc,
|
||||
bool readable)
|
||||
: Stream{std::move(ref)},
|
||||
fd{static_cast<FileHandle::Type>(desc)},
|
||||
rw{readable}
|
||||
: Stream{std::move(ref)}, fd{desc}, rw{readable}
|
||||
{ }
|
||||
|
||||
public:
|
||||
|
||||
@ -47,7 +47,12 @@ private:
|
||||
template<typename T>
|
||||
struct UVTypeWrapper {
|
||||
using Type = T;
|
||||
|
||||
template<typename U, typename = std::enable_if_t<std::is_convertible<U, T>::value>>
|
||||
constexpr UVTypeWrapper(U val): value{static_cast<T>(val)} { }
|
||||
|
||||
constexpr UVTypeWrapper(Type val): value{val} { }
|
||||
|
||||
constexpr operator Type() const noexcept { return value; }
|
||||
private:
|
||||
const Type value;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user