From 10fc7da79d316f6e0917031850ba81a4d4b781d6 Mon Sep 17 00:00:00 2001 From: yvt Date: Sun, 19 May 2019 14:53:32 +0900 Subject: [PATCH] Add `StreamHandle::operator bool` --- Sources/Core/IStream.cpp | 2 ++ Sources/Core/IStream.h | 1 + 2 files changed, 3 insertions(+) diff --git a/Sources/Core/IStream.cpp b/Sources/Core/IStream.cpp index 801333d6..3ac25548 100644 --- a/Sources/Core/IStream.cpp +++ b/Sources/Core/IStream.cpp @@ -152,6 +152,8 @@ namespace spades { return o->stream; } + StreamHandle::operator bool() const { return o->stream; } + void StreamHandle::Reset() { if (o) { o->Release(); diff --git a/Sources/Core/IStream.h b/Sources/Core/IStream.h index 43df2731..0bb5afa1 100644 --- a/Sources/Core/IStream.h +++ b/Sources/Core/IStream.h @@ -87,5 +87,6 @@ namespace spades { void Reset(); IStream *operator->() const; operator IStream *() const; + operator bool() const; }; }