From f0a05e06e2e6ecec82c67ca9ffd21b3df2794fed Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 16 Apr 2018 15:54:30 +1000 Subject: [PATCH] point: add forwarding assignment operator --- point.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/point.hpp b/point.hpp index 4967cb6f..f7091094 100644 --- a/point.hpp +++ b/point.hpp @@ -34,6 +34,17 @@ namespace util { { using coord::base>::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 + point& + operator= (Arg&&arg) + { + coord::base>::operator=(std::forward (arg)); + return *this; + } + vector to (point dst) const { return dst - *this; } vector from (point src) const { return *this - src; }