mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-26 12:01:47 +00:00
srb2::MobjListView: support copy assignment
This commit is contained in:
parent
a211ae73fe
commit
aba94d205b
1 changed files with 8 additions and 0 deletions
|
|
@ -34,6 +34,14 @@ struct MobjListView
|
||||||
using reference = value_type;
|
using reference = value_type;
|
||||||
|
|
||||||
Iterator(pointer ptr, F adv) : ptr_(deref(ptr)), adv_(adv) {}
|
Iterator(pointer ptr, F adv) : ptr_(deref(ptr)), adv_(adv) {}
|
||||||
|
Iterator& operator=(const Iterator& b)
|
||||||
|
{
|
||||||
|
// adv_ may be a lambda. However, lambdas are not
|
||||||
|
// copy assignable. Therefore, perform copy
|
||||||
|
// construction instead!
|
||||||
|
this->~Iterator();
|
||||||
|
return *new(this) Iterator {b};
|
||||||
|
}
|
||||||
|
|
||||||
bool operator==(const Iterator& b) const { return ptr_ == b.ptr_; };
|
bool operator==(const Iterator& b) const { return ptr_ == b.ptr_; };
|
||||||
bool operator!=(const Iterator& b) const { return ptr_ != b.ptr_; };
|
bool operator!=(const Iterator& b) const { return ptr_ != b.ptr_; };
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue