point: add self-division operator
This commit is contained in:
parent
38d3fc1961
commit
60f2a7e00d
13
point.cpp
13
point.cpp
@ -53,6 +53,19 @@ util::point<S,T>::operator* (T f) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
template <size_t S, typename T>
|
||||||
|
util::point<S,T>&
|
||||||
|
util::point<S,T>::operator/= (T f)
|
||||||
|
{
|
||||||
|
std::transform (std::begin (this->data),
|
||||||
|
std::end (this->data),
|
||||||
|
std::begin (this->data),
|
||||||
|
[f] (auto i) { return i / f; });
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template <size_t S, typename T>
|
template <size_t S, typename T>
|
||||||
util::point<S,T>
|
util::point<S,T>
|
||||||
|
@ -44,6 +44,7 @@ namespace util {
|
|||||||
// arithetic operators
|
// arithetic operators
|
||||||
point<S,T>& operator*= (T);
|
point<S,T>& operator*= (T);
|
||||||
point<S,T> operator* (T) const;
|
point<S,T> operator* (T) const;
|
||||||
|
point<S,T>& operator/= (T);
|
||||||
point<S,T> operator/ (T) const;
|
point<S,T> operator/ (T) const;
|
||||||
|
|
||||||
vector<S,T> operator- (const point<S,T>&) const;
|
vector<S,T> operator- (const point<S,T>&) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user