Skip to content

Commit

Permalink
Merge pull request #2020 from DARMA-tasking/2019-tracescopedevent-and…
Browse files Browse the repository at this point in the history
…-tracescopednote-should-have-deleted-copy-constructors-and-defined-move-constructorsassign

#2019: add move constructor/assign to TraceScopedEvent and TraceScopedNote
  • Loading branch information
PhilMiller authored Nov 28, 2022
2 parents 1259a37 + 22d105f commit f5722f5
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 f5722f5

Please sign in to comment.