|
Dedekind 0.0.0
A structuralist C++23 Module Library
|
Pure syntactic shape: T supports the in-place additive-group operator surface +=, -=.
More...
Pure syntactic shape: T supports the in-place additive-group operator surface +=, -=.
The compound-assignment sibling of HasGroupOperatorsAdd: where the latter checks the binary out-of-place operators +, - (and unary -), this concept checks the in-place compound forms +=, -=. Both yield T& (the standard form).
Mathematically, += / -= realise the additive group's action on its own underlying set (translate-in-place by another element of the group); HasSuccessorOperators is the special case where the translation is by the unit 1.
Subtle interaction with integer promotion: per [expr.ass]/3, a += b is equivalent to a = T(a + b) — the implicit narrowing conversion brings the promoted result back to T. So HasCompoundGroupOperatorsAdd<unsigned short> fires even though HasGroupOperatorsAdd<unsigned short> refuses (because a + b returns int via promotion, not unsigned short). This is a real distinction the type system surfaces: narrow unsigned types close under the in-place compound forms but not under the out-of-place binary forms.
Introduced under #394.