|
|
@@ -139,19 +139,43 @@ VECTOR_ENABLE_IF_LT_N(i, value_type &) name() { return _data[i]; }
|
|
|
return *this;
|
|
|
}
|
|
|
|
|
|
+ vector& operator+=(T const & other) {
|
|
|
+ return operator+=(vector(other, fill));
|
|
|
+ }
|
|
|
+
|
|
|
vector operator+(vector const & other) const {
|
|
|
return vector{*this} += other;
|
|
|
}
|
|
|
|
|
|
+ vector operator+(T const & other) const {
|
|
|
+ return operator+(vector(other, fill));
|
|
|
+ }
|
|
|
+
|
|
|
+ friend vector operator+(T const & lhs, vector const & rhs) {
|
|
|
+ return rhs + lhs;
|
|
|
+ }
|
|
|
+
|
|
|
vector& operator-=(vector const & other) {
|
|
|
VECTOR_FOR_EACH(i) { _data[i] -= other[i]; }
|
|
|
return *this;
|
|
|
}
|
|
|
|
|
|
+ vector& operator-=(T const & other) {
|
|
|
+ return operator-=(vector(other, fill));
|
|
|
+ }
|
|
|
+
|
|
|
vector operator-(vector const & other) const {
|
|
|
return vector{*this} -= other;
|
|
|
}
|
|
|
|
|
|
+ vector operator-(T const & other) const {
|
|
|
+ return operator-(vector(other, fill));
|
|
|
+ }
|
|
|
+
|
|
|
+ friend vector operator-(T const & lhs, vector const & rhs) {
|
|
|
+ return vector(lhs, fill) - rhs;
|
|
|
+ }
|
|
|
+
|
|
|
vector operator-() const {
|
|
|
return vector{} -= *this;
|
|
|
}
|
|
|
@@ -272,6 +296,14 @@ VECTOR_ENABLE_IF_LT_N(i, value_type &) name() { return _data[i]; }
|
|
|
bool operator> (vector<T, N> const & lhs, vector<T, N> const & rhs) { return compare(lhs, rhs) > 0; }
|
|
|
template <typename T, std::size_t N>
|
|
|
bool operator>=(vector<T, N> const & lhs, vector<T, N> const & rhs) { return compare(lhs, rhs) >= 0; }
|
|
|
+
|
|
|
+#undef VECTOR_FOR_EACH
|
|
|
+#undef VECTOR_FOR_EACH_RANGE
|
|
|
+#undef VECTOR_ACCESS_FN
|
|
|
+#undef VECTOR_DISABLE_IF_VECTOR
|
|
|
+#undef VECTOR_ENABLE_IF_EQ_T
|
|
|
+#undef VECTOR_ENABLE_IF_EQ_N
|
|
|
+#undef VECTOR_ENABLE_IF_LT_N
|
|
|
} }
|
|
|
|
|
|
template <typename... Ts>
|