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:
James R 2023-08-27 01:27:32 -07:00 committed by toaster
parent f30763ce1d
commit c497dcaf49

View file

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