vector: add forwarding assignment operator

This commit is contained in:
Danny Robson 2018-04-11 19:28:03 +10:00
parent d7b36b0ee3
commit 1cc4f90b52

View File

@ -33,7 +33,17 @@ namespace util {
struct vector : public coord::base<S,T,vector<S,T>>
{
using coord::base<S,T,vector<S,T>>::base;
using coord::base<S,T,vector<S,T>>::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 <typename Arg>
vector&
operator= (Arg&&arg)
{
coord::base<S,T,vector<S,T>>::operator=(std::forward<Arg> (arg));
return *this;
}
// representations
template <size_t D = 4>