31 template <
typename T,
typename U = T>
33 friend bool operator!=(
const T &lhs,
const U &rhs) {
return !(lhs == rhs); }
34 friend bool operator>(
const T &lhs,
const U &rhs) {
return rhs < lhs; }
35 friend bool operator<=(
const T &lhs,
const U &rhs) {
return !(lhs > rhs); }
36 friend bool operator>=(
const T &lhs,
const U &rhs) {
return !(lhs < rhs); }
42 friend T operator+(T lhs,
const T &rhs) {
return lhs += rhs; }
43 friend T operator-(T lhs,
const T &rhs) {
return lhs -= rhs; }
44 friend T operator*(T lhs,
const T &rhs) {
return lhs *= rhs; }
45 friend T operator/(T lhs,
const T &rhs) {
return lhs /= rhs; }
49 template <
typename T,
typename U>
51 friend T operator+(T lhs,
const U &rhs) {
return lhs += rhs; }
52 friend T operator-(T lhs,
const U &rhs) {
return lhs -= rhs; }
53 friend T operator*(T lhs,
const U &rhs) {
return lhs *= rhs; }
54 friend T operator/(T lhs,
const U &rhs) {
return lhs /= rhs; }
56 friend T operator+(
const U &lhs, T rhs) {
return rhs += lhs; }
57 friend T operator*(
const U &lhs, T rhs) {
return rhs *= lhs; }
Helper template for Arithmetic operations. Derive from this to provide +,-,*,/, given +=,...
Definition: Template.hpp:50
Helper template for Arithmetic operations. Derive from this to provide +,-,*,/, given +=,...
Definition: Template.hpp:41
Helper template for comparisons. Derive from this to provide !=,>,<=,>=, given == and <.
Definition: Template.hpp:32
qip library: A collection of useful functions
Definition: Array.hpp:8