Skip to content

Commit

Permalink
Add nodiscard attributes and minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mogemimi committed Aug 8, 2019
1 parent 0abf705 commit c908bf0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion include/Pomdog/Signals/detail/DelegateBody.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class POMDOG_EXPORT DelegateConnectionBody final : public ConnectionBody {
return false;
}

std::unique_ptr<ConnectionBody> DeepCopy() const override
[[nodiscard]] std::unique_ptr<ConnectionBody> DeepCopy() const override
{
auto conn = std::make_unique<DelegateConnectionBody>();
conn->weakSignal = weakSignal;
Expand All @@ -87,6 +87,7 @@ class POMDOG_EXPORT DelegateBody<void(Arguments...)> final
{
slot = std::forward<Function>(slotIn);
++slotID;
POMDOG_ASSERT(slotID > 0);

if (slot == nullptr) {
return nullptr;
Expand Down
6 changes: 3 additions & 3 deletions include/Pomdog/Signals/detail/SignalBody.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class POMDOG_EXPORT ConnectionBody {
virtual ~ConnectionBody() = default;
virtual void Disconnect() = 0;
[[nodiscard]] virtual bool Valid() const = 0;
virtual std::unique_ptr<ConnectionBody> DeepCopy() const = 0;
[[nodiscard]] virtual std::unique_ptr<ConnectionBody> DeepCopy() const = 0;
};

template <typename Function>
Expand Down Expand Up @@ -59,7 +59,7 @@ class ConnectionBodyOverride final : public ConnectionBody {
slotIndex = std::nullopt;
}

bool Valid() const override
[[nodiscard]] bool Valid() const override
{
if (slotIndex == std::nullopt) {
return false;
Expand All @@ -71,7 +71,7 @@ class ConnectionBodyOverride final : public ConnectionBody {
return false;
}

std::unique_ptr<ConnectionBody> DeepCopy() const override
[[nodiscard]] std::unique_ptr<ConnectionBody> DeepCopy() const override
{
auto conn = std::make_unique<ConnectionBodyOverride>();
conn->weakSignal = weakSignal;
Expand Down

0 comments on commit c908bf0

Please sign in to comment.