-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use concepts on BarycentreCalculator and drop the specializations #3919
Use concepts on BarycentreCalculator and drop the specializations #3919
Conversation
@@ -52,8 +71,7 @@ T Barycentre(Container<T> const& ts, Container<Scalar> const& weights) { | |||
BarycentreCalculator<T, Scalar> calculator; | |||
auto ts_it = ts.begin(); | |||
auto weights_it = weights.begin(); | |||
for (; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the old formatting, one line for stanza of the loop header.
@@ -108,6 +108,9 @@ using enable_if_vector_t = typename enable_if_vector<T, U>::type; | |||
template<typename T1, typename T2> | |||
class Pair final { | |||
public: | |||
Pair() | |||
requires std::default_initializable<T1> && std::default_initializable<T2> = | |||
default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this fit at the end of the previous line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No.
Keep an optimization for the subtraction of 0 conditioned on concepts.
Compilation error:
Before
BarycentreCalculator<Mass, Position<World>> b1;
[A long list of
operator*
s]BarycentreCalculator<Mass, Velocity<World>> b2;
b2.Add(1 * Kilogram, World::unmoving); b2.Get();
This one fails only in
Get()
:[A long list of
operator/
s]After
BarycentreCalculator<Mass, Position<World>> b1;
BarycentreCalculator<Mass, Velocity<World>> b2;
[A long list of
operator*
s]