point: add forwarding assignment operator

This commit is contained in:
Danny Robson 2018-04-16 15:54:30 +10:00
parent e7a76081e0
commit f0a05e06e2

View File

@ -34,6 +34,17 @@ namespace util {
{ {
using coord::base<S,T,point<S,T>>::base; using coord::base<S,T,point<S,T>>::base;
// use a forwarding assignment operator so that we can let the base
// take care of the many different types of parameters. otherwise we
// have to deal with scalar, vector, initializer_list, ad nauseum.
template <typename Arg>
point&
operator= (Arg&&arg)
{
coord::base<S,T,point<S,T>>::operator=(std::forward<Arg> (arg));
return *this;
}
vector<S,T> to (point dst) const { return dst - *this; } vector<S,T> to (point dst) const { return dst - *this; }
vector<S,T> from (point src) const { return *this - src; } vector<S,T> from (point src) const { return *this - src; }