From a0f6f85ad14062c8f08a40a64ae0fb6dbd35d551 Mon Sep 17 00:00:00 2001 From: Gabriel Busnot Date: Tue, 24 Jan 2023 10:02:17 +0000 Subject: [PATCH] sim: Suppress deleted operator= warn in Sys::Threads::const_it Swapping the reference member to threads for a pointer restores trivial copiablity and movability. Change-Id: I18d3a5b908d8575aef198f457b85060aa202bd5f Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67454 Reviewed-by: Giacomo Travaglini Maintainer: Giacomo Travaglini Tested-by: kokoro --- src/sim/system.hh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/sim/system.hh b/src/sim/system.hh index 1d179e962a..d2725c32a9 100644 --- a/src/sim/system.hh +++ b/src/sim/system.hh @@ -152,19 +152,16 @@ class System : public SimObject, public PCEventScope class const_iterator { private: - const Threads &threads; + Threads const* threads; int pos; friend class Threads; const_iterator(const Threads &_threads, int _pos) : - threads(_threads), pos(_pos) + threads(&_threads), pos(_pos) {} public: - const_iterator(const const_iterator &) = default; - const_iterator &operator = (const const_iterator &) = default; - using iterator_category = std::forward_iterator_tag; using value_type = ThreadContext *; using difference_type = int; @@ -181,16 +178,16 @@ class System : public SimObject, public PCEventScope const_iterator operator ++ (int) { - return const_iterator(threads, pos++); + return const_iterator(*threads, pos++); } - reference operator * () { return threads.thread(pos).context; } - pointer operator -> () { return &threads.thread(pos).context; } + reference operator * () { return threads->thread(pos).context; } + pointer operator -> () { return &threads->thread(pos).context; } bool operator == (const const_iterator &other) const { - return &threads == &other.threads && pos == other.pos; + return threads == other.threads && pos == other.pos; } bool