forked from foonathan/type_safe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Subtraction and division are noncommutative ((a - b) != (b - a)), and when mixing different types you might not want these operators to work both ways. This commit adds mixed_[operator]_noncommutative, which does _not_ declare the operator overloads with the strong_typedef as the right hand side and the other (mixed) type as the left hand side Example: struct year : strong_typedef<year, int>, mixed_subtraction_noncommutative<year, int> {}; year y(2018); y - 3; // OK 3 - y; // compile error, operator not found.
- Loading branch information
1 parent
9db40a3
commit c198661
Showing
2 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters