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 <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabriel Busnot
2023-01-24 10:02:17 +00:00
committed by Gabriel B.
parent 7f4c92c910
commit a0f6f85ad1

View File

@@ -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