c++ - Dynamically Allocated mpfr_t matrix with std::vector -


i want have class works matrix of mpfr_t elements. thought stl vectors great idea dynamically allocating many of these want, errors here.

#ifndef gmpmatrix_h #define gmpmatrix_h  #include <vector> #include <mpfr.h>  typedef std::vector<mpfr_t> mpvector; typedef std::vector<mpvector> mpmatrix;  class gmpmatrix {     private:         int n;         int m;         mpmatrix elements;      public:         gmpmatrix() {}         gmpmatrix(int n, int m)         {             this->n = n;             this->m = m;              (int = 0; < n; ++i)             {                 mpvector e_push(m);                 (int j = 0; j < m; ++j)                 {                     mpfr_t e;                     mpfr_init(e);                     e_push.push_back(e);                 }             }         }           ~gmpmatrix() {} };  #endif // gmpmatrix_h 

the errors are:

   /usr/include/c++/5/ext/new_allocator.h:120:4: error: parenthesized initializer in array new [-fpermissive]       { ::new((void *)__p) _up(std::forward<_args>(__args)...); }         ^     /usr/include/c++/5/ext/new_allocator.h:120:4: error: no matching function call ‘__mpfr_struct::__mpfr_struct(const __mpfr_struct [1])’ 

i've looked , can't figure out. there way make vector< vector<mpfr_t> > work? know happening?

mpfr_t c-style array type. cannot store in std::vector.

you can wrap mpfr_t in simple struct , store those.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -