Skip to content

Commit

Permalink
Make scope_guard nodiscard
Browse files Browse the repository at this point in the history
We don't want to mistakenly trigger the destructor before the end of the
scope.
  • Loading branch information
denizevrenci authored and ispeters committed Apr 24, 2024
1 parent 44a4f5f commit 8fd4b0c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/unifex/scope_guard.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
namespace unifex {

template <typename Func>
struct scope_guard {
struct [[nodiscard]] scope_guard {
private:
static_assert(std::is_nothrow_move_constructible_v<Func>);
UNIFEX_NO_UNIQUE_ADDRESS Func func_;
Expand Down

0 comments on commit 8fd4b0c

Please sign in to comment.