From 1cc4f90b521cf3c6fd43f365b4000706a262fa05 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Wed, 11 Apr 2018 19:28:03 +1000 Subject: [PATCH] vector: add forwarding assignment operator --- vector.hpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/vector.hpp b/vector.hpp index 9a5908ee..4b2f5885 100644 --- a/vector.hpp +++ b/vector.hpp @@ -33,7 +33,17 @@ namespace util { struct vector : public coord::base> { using coord::base>::base; - using coord::base>::operator=; + + // 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 + vector& + operator= (Arg&&arg) + { + coord::base>::operator=(std::forward (arg)); + return *this; + } // representations template