Require explicit handle validation
Using operator bool() hid ambiguity when handle was polymorfic with bool. Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
f1e894aefd
commit
47d10e2d78
@ -2421,7 +2421,9 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
/// Returns true if socket handle is valid
|
/// Returns true if socket handle is valid
|
||||||
///
|
///
|
||||||
operator bool() const noexcept { return m_h != stdex::invalid_socket; }
|
/// \note Implementing `operator bool() const` would be correct C++ approach here. Unfortunately, compiler would prefer it where `socket_t` is expected.
|
||||||
|
///
|
||||||
|
bool valid() const noexcept { return m_h != stdex::invalid_socket; }
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Returns socket handle
|
/// Returns socket handle
|
||||||
@ -3219,7 +3221,7 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
/// Returns true if file has a valid handle
|
/// Returns true if file has a valid handle
|
||||||
///
|
///
|
||||||
operator bool() const noexcept { return m_source; }
|
bool valid() const noexcept { return m_source.valid(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
file m_source;
|
file m_source;
|
||||||
|
@ -193,7 +193,7 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
/// Returns true if object has a valid handle
|
/// Returns true if object has a valid handle
|
||||||
///
|
///
|
||||||
operator bool() const noexcept { return m_h != TR::invalid_handle; }
|
bool valid() const noexcept { return m_h != TR::invalid_handle; }
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Returns object handle
|
/// Returns object handle
|
||||||
|
Loading…
x
Reference in New Issue
Block a user