NRVec from std::list

This commit is contained in:
Jiri Pittner 2022-02-18 19:03:19 +01:00
parent 10985a146b
commit 0e8c20770f
2 changed files with 11 additions and 0 deletions

7
vec.cc
View File

@ -898,6 +898,13 @@ return -1;
} }
template<typename T>
NRVec<T>::NRVec(const std::list<T> l)
{
resize(l.size());
int ii=0;
for(typename std::list<T>::const_iterator i=l.begin(); i!=l.end(); ++i) (*this)[ii++] = *i;
}
/***************************************************************************//** /***************************************************************************//**

4
vec.h
View File

@ -21,6 +21,7 @@
#define _LA_VEC_H_ #define _LA_VEC_H_
#include "la_traits.h" #include "la_traits.h"
#include <list>
namespace LA { namespace LA {
@ -140,6 +141,9 @@ public:
//! inlined copy constructor //! inlined copy constructor
inline NRVec(const NRVec &rhs); inline NRVec(const NRVec &rhs);
//! constructor from std::list
NRVec(const std::list<T> l);
//! complexifying constructor //! complexifying constructor
NRVec(const typename LA_traits_complex<T>::NRVec_Noncomplex_type &rhs, bool imagpart=false);//construct complex from real NRVec(const typename LA_traits_complex<T>::NRVec_Noncomplex_type &rhs, bool imagpart=false);//construct complex from real