Skip to content

Commit

Permalink
#2019: trace: add rule of 5 special methods to TraceScopedEvent and T…
Browse files Browse the repository at this point in the history
…raceScopedNote
  • Loading branch information
nmm0 authored and cz4rs committed Dec 28, 2022
1 parent bf9e941 commit 37f80b5
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/vt/trace/trace_user.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,20 @@ struct TraceScopedEvent final {
event_(event)
{ }

TraceScopedEvent(TraceScopedEvent const&) = delete;
TraceScopedEvent(TraceScopedEvent &&other) noexcept
{
std::swap(begin_, other.begin_);
std::swap(event_, other.event_);
}

TraceScopedEvent& operator=(TraceScopedEvent const&) = delete;
TraceScopedEvent& operator=(TraceScopedEvent &&other) noexcept
{
std::swap(begin_, other.begin_);
std::swap(event_, other.event_);
return *this;
}

~TraceScopedEvent() { end(); }

Expand Down Expand Up @@ -263,7 +276,22 @@ struct TraceScopedNote final {
note_(in_note)
{ }

TraceScopedNote(TraceScopedNote const&) = delete;
TraceScopedNote(TraceScopedNote &&other) noexcept
{
std::swap(begin_, other.begin_);
std::swap(event_, other.event_);
std::swap(note_, other.note_);
}

TraceScopedNote& operator=(TraceScopedNote const&) = delete;
TraceScopedNote& operator=(TraceScopedNote &&other) noexcept
{
std::swap(begin_, other.begin_);
std::swap(event_, other.event_);
std::swap(note_, other.note_);
return *this;
}

~TraceScopedNote() { end(); }

Expand Down

0 comments on commit 37f80b5

Please sign in to comment.