2012-03-03 8 views
1

一般的な情報として、私はboost 1.46を使用します。このバージョン以降、libas libには何の変更もありませんでした。コンパイルエラー - boost :: numeric :: ublas :: coordinate_matrix

gccバージョン4.6を使用してコンパイルします。

だから私の問題。私は、自分自身で定義されたインターフェースにブースト・マトリックス・クラスを合わせるはずの非常に基本的なクラスを持っています。クラスは次のようになります。

template< typename TYPE > 
class BoostCoordinateMatrix: public MatrixInterface<TYPE> , 
    public boost::numeric::ublas::coordinate_matrix<TYPE> { 
public: 
BoostCoordinateMatrix() : 
    boost::numeric::ublas::coordinate_matrix<TYPE>() { 
} 

BoostCoordinateMatrix(int rows, int columns) : 
    boost::numeric::ublas::coordinate_matrix<TYPE>(rows, columns) { 
} 

int rows() const { 
    return this->size1(); 
} 

int columns() const { 
    return this->size2(); 
} 

virtual void set(int row, int column, TYPE value) { 
    (*this)(row, column) = value; 
} 

TYPE& operator()(int i, int j) { 
    return this->boost::numeric::ublas::coordinate_matrix<TYPE>::operator()(
      i, j).ref(); 
} 

TYPE operator()(int i, int j) const { 
    return this->boost::numeric::ublas::coordinate_matrix<TYPE>::operator()(
      i, j); 
} 

}; 

このクラスをコンパイルすると、私は両方のオペレータのためのコンパイラエラーを取得する(I、int型のjはint型):

./inc/boost_coordinate_matrix.h:38:15: instantiated from ‘TYPE BoostCoordinateMatrix::operator()(int, int) const [with TYPE = double]’ ./inc/flow_field_matrix_free_interface_impl.h:697:1: instantiated from here /usr/include/c++/4.6/bits/stl_tempbuf.h:257:6: error: invalid initialization of non-const reference of type ‘boost::numeric::ublas::index_triple, boost::numeric::ublas::unbounded_array, boost::numeric::ublas::unbounded_array > > >&’ from an rvalue of type ‘boost::numeric::ublas::indexed_iterator, boost::numeric::ublas::unbounded_array, boost::numeric::ublas::unbounded_array > >, std::random_access_iterator_tag>::reference {aka boost::numeric::ublas::index_triple, boost::numeric::ublas::unbounded_array, boost::numeric::ublas::unbounded_array > > >}’ /usr/include/c++/4.6/bits/stl_tempbuf.h:232:5: error: in passing argument 3 of ‘void std::__uninitialized_construct_buf(_ForwardIterator, _ForwardIterator, _Tp&) [with _ForwardIterator = boost::numeric::ublas::index_triple, boost::numeric::ublas::unbounded_array, boost::numeric::ublas::unbounded_array > > >*, _Tp = boost::numeric::ublas::index_triple, boost::numeric::ublas::unbounded_array, boost::numeric::ublas::unbounded_array > > >]’

私は誰かが私を助けることができると思います。

+0

BoostCoordinateMatrix :: operator()(int、int)const'の '.ref()'メンバ関数は何ですか? –

+0

operator(int i、int j)は、実際の参照の代わりにヘルパークラスを返します。 .ref()は正しい参照を取得します。少なくとも、これはどのように動作すると思いますか?私はcompressed_matrixデータ型の作業インタフェースを持っています。このインタフェースもこの構文を使用します。 編集:このコードで誤った関数上の.ref()が見つかりました。フォーマット中に混乱しました。これを修正します。それにもかかわらず、エラーは正しいものでした... – Thorsten

+0

'/inc/flow_field_matrix_free_interface_impl.h:697:1'で何が起こっていますか? – user1201210

答えて

関連する問題