From 0e8c20770f2f211d66bc6ebfb0c91779b6704786 Mon Sep 17 00:00:00 2001 From: Jiri Pittner Date: Fri, 18 Feb 2022 19:03:19 +0100 Subject: [PATCH] NRVec from std::list --- vec.cc | 7 +++++++ vec.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/vec.cc b/vec.cc index fc121ce..9a38566 100644 --- a/vec.cc +++ b/vec.cc @@ -898,6 +898,13 @@ return -1; } +template +NRVec::NRVec(const std::list l) +{ +resize(l.size()); +int ii=0; +for(typename std::list::const_iterator i=l.begin(); i!=l.end(); ++i) (*this)[ii++] = *i; +} /***************************************************************************//** diff --git a/vec.h b/vec.h index 4debbab..c0450da 100644 --- a/vec.h +++ b/vec.h @@ -21,6 +21,7 @@ #define _LA_VEC_H_ #include "la_traits.h" +#include namespace LA { @@ -140,6 +141,9 @@ public: //! inlined copy constructor inline NRVec(const NRVec &rhs); + //! constructor from std::list + NRVec(const std::list l); + //! complexifying constructor NRVec(const typename LA_traits_complex::NRVec_Noncomplex_type &rhs, bool imagpart=false);//construct complex from real