littles things

This commit is contained in:
Andrea Blankenstijn 2021-08-12 16:09:26 +02:00
parent d3be108df6
commit d1cd97809e
3 changed files with 6 additions and 10 deletions

View File

@ -102,7 +102,7 @@ namespace bwidgets
template<Numeric N>
[[nodiscard]] inline auto operator/(const N& operand) const noexcept
{
SDL_assert(operand != 0); // NOLINT
SDL_assert_release(operand != 0); // NOLINT
return _operate<N>(operand, [](const N& a, const N& b) { return a / b; });
}

View File

@ -22,7 +22,10 @@ namespace bwidgets
virtual ~OpaqueStruct() noexcept
{
_deleter(_c_pod);
try {
_deleter(_c_pod);
} catch (...) {
}
};
[[nodiscard]] inline auto* operator()() const
@ -40,13 +43,6 @@ namespace bwidgets
Wrapper(T* ptr, const Deleter& d) : _data(ptr, d) {}
};
};
template<typename... Ts>
void discard(Ts*&... ptrs)
{
((delete ptrs), ...);
((ptrs = nullptr), ...);
}
}
#endif

View File

@ -31,8 +31,8 @@ namespace bwidgets
virtual ~Widget() = default;
virtual auto handle_event(const SDL_Event&) -> Widget*;
[[nodiscard]] virtual auto size() const noexcept -> Size = 0;
virtual auto render() -> Widget* final;
virtual auto renderer(const std::shared_ptr<Renderer>&) -> Widget* final;
virtual auto viewport(const SDL_Rect&) -> Widget* final;