mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
srb2::Draw::Chain: make copy assignment private, make bruh moments a little more obvious
If you define a variable with type auto and initialize it
with the result of a builder chain -- e.g.
auto var = Draw().x(0)
-- the resulting variable will be an instance of
srb2::Draw::Chain, and calling builder methods on it will
modify the instance itself, instead of creating a
temporary, like an instance of srb2::Draw would.
Hiding the copy assignment can make this a little more
obvious by emitting an error if you try to reassign the
variable later. E.g.
var = var.x(0)
That's the best I can do to mitigate this.
This commit is contained in:
parent
f30763ce1d
commit
c497dcaf49
1 changed files with 1 additions and 0 deletions
|
|
@ -148,6 +148,7 @@ public:
|
|||
constexpr Chain() {}
|
||||
explicit Chain(float x, float y) : x_(x), y_(y) {}
|
||||
Chain(const Chain&) = default;
|
||||
Chain& operator=(const Chain&) = default;
|
||||
|
||||
struct Clipper
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue