jbuckmccready / cavalier_contours

2D polyline/shape library for offsetting, combining, etc.
Apache License 2.0
144 stars 12 forks source link

Pass by T or &T for small structs implementing Copy? #1

Open jbuckmccready opened 3 years ago

jbuckmccready commented 3 years ago

For small structures that implement Copy such as Vector2 and PlineVertex, functions should be consistent in passing them by T (value) or by &T (reference), which do we choose? Currently they are always passed by value T. Compiled code is likely to be the same with fields being loaded into registers - question is mostly from an ergonomics/consistency consideration.

Advantages of pass by value:

Disadvantage of pass by value: