B
Es klappt auch schon eindimensional nicht:
class Matrix {
public:
Matrix();
Matrix(int rows): mat(rows){};
private:
vector<mpq_t > mat;
};
selbe Fehlermeldung:
../Matrix.h: In constructor ‘std::vector<_Tp, _Alloc>::vector(size_t, const _Tp&, const _Alloc&) [with _Tp = __mpq_struct [1], _Alloc = std::allocator<__mpq_struct [1]>]’:
../Matrix.h:20: error: conversion from ‘int’ to non-scalar type ‘__mpq_struct [1]’ requested
/usr/include/c++/4.3/bits/stl_construct.h: In function ‘void std::_Destroy(_Tp*) [with _Tp = __mpq_struct [1]]’:
/usr/include/c++/4.3/bits/stl_construct.h:103: instantiated from ‘void std::_Destroy(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = __mpq_struct (*)[1]]’
/usr/include/c++/4.3/bits/stl_construct.h:128: instantiated from ‘void std::_Destroy(_ForwardIterator, _ForwardIterator, std::allocator<_T2>&) [with _ForwardIterator = __mpq_struct (*)[1], _Tp = __mpq_struct [1]]’
/usr/include/c++/4.3/bits/stl_vector.h:300: instantiated from ‘std::vector<_Tp, _Alloc>::~vector() [with _Tp = __mpq_struct [1], _Alloc = std::allocator<__mpq_struct [1]>]’
../Matrix.h:20: instantiated from here
/usr/include/c++/4.3/bits/stl_construct.h:88: error: request for member ‘~__mpq_struct [1]’ in ‘* __pointer’, which is of non-class type ‘__mpq_struct [1]’
/usr/include/c++/4.3/bits/stl_algobase.h: In function ‘typename __gnu_cxx::__enable_if<(! std::__is_scalar::__value), _OutputIterator>::__type std::__fill_n_a(_OutputIterator, _Size, const _Tp&) [with _OutputIterator = __mpq_struct (*)[1], _Size = unsigned int, _Tp = __mpq_struct [1]]’:
/usr/include/c++/4.3/bits/stl_algobase.h:784: instantiated from ‘_OI std::fill_n(_OI, _Size, const _Tp&) [with _OI = __mpq_struct (*)[1], _Size = unsigned int, _Tp = __mpq_struct [1]]’
/usr/include/c++/4.3/bits/stl_uninitialized.h:209: instantiated from ‘static void std::__uninitialized_fill_n<true>::uninitialized_fill_n(_ForwardIterator, _Size, const _Tp&) [with _ForwardIterator = __mpq_struct (*)[1], _Size = unsigned int, _Tp = __mpq_struct [1]]’
/usr/include/c++/4.3/bits/stl_uninitialized.h:228: instantiated from ‘void std::uninitialized_fill_n(_ForwardIterator, _Size, const _Tp&) [with _ForwardIterator = __mpq_struct (*)[1], _Size = unsigned int, _Tp = __mpq_struct [1]]’
/usr/include/c++/4.3/bits/stl_uninitialized.h:323: instantiated from ‘void std::__uninitialized_fill_n_a(_ForwardIterator, _Size, const _Tp&, std::allocator<_Tp2>&) [with _ForwardIterator = __mpq_struct (*)[1], _Size = unsigned int, _Tp = __mpq_struct [1], _Tp2 = __mpq_struct [1]]’
/usr/include/c++/4.3/bits/stl_vector.h:976: instantiated from ‘void std::vector<_Tp, _Alloc>::_M_fill_initialize(size_t, const _Tp&) [with _Tp = __mpq_struct [1], _Alloc = std::allocator<__mpq_struct [1]>]’
/usr/include/c++/4.3/bits/stl_vector.h:236: instantiated from ‘std::vector<_Tp, _Alloc>::vector(size_t, const _Tp&, const _Alloc&) [with _Tp = __mpq_struct [1], _Alloc = std::allocator<__mpq_struct [1]>]’
../Matrix.h:20: instantiated from here
/usr/include/c++/4.3/bits/stl_algobase.h:741: error: invalid array assignment
schade.. kennt einer einen ausweg
(sorry LaraM, hätte einen eigenen Beitrag aufmachen sollen )
EDIT: Ich habe einen eigenen Beitrag aufgemacht!