1

一般的な情報として、boost 1.46 を使用しています。このバージョン以降、ublas lib に変更はありません。

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

だから今私の問題。ブーストマトリックスクラスを自己定義インターフェースに適合させることになっている非常に基本的なクラスがあります。クラスは次のようになります。

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);
}

};

このクラスをコンパイルすると、両方の演算子 (int i, int j) に対してコンパイラ エラーが発生します。

./inc/boost_coordinate_matrix.h:38:15: 'TYPE BoostCoordinateMatrix::operator()(int, int) const [with TYPE = double]' からインスタンス化 ./inc/flow_field_matrix_free_interface_impl.h:697:1: ここからインスタンス化/usr/include/c++/4.6/bits/stl_tempbuf.h:257:6: エラー: タイプ 'boost::numeric::ublas::index_triple、boost::numeric::ublas: の非定数参照の無効な初期化: :unbounded_array、boost::numeric::ublas::unbounded_array > > >&' タイプ '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: エラー:'void std::__uninitialized_construct_buf(_ForwardIterator, _ForwardIterator, _Tp&) [ with _ForwardIterator = boost::numeric::ublas::index_triple, boost::numeric::ublas::unbounded_array, boost::numeric:: の引数3を渡す際にublas::unbounded_array > > >*, _Tp = boost::numeric::ublas::index_triple, boost::numeric::ublas::unbounded_array, boost::numeric::ublas::unbounded_array > > >]'</ p>

誰かが私を助けてくれることを願っています。

4

1 に答える 1

0

わかりました私は問題を見つけたと思います:

http://boost.2283326.n4.nabble.com/example-usage-of-coordinate-matrix-fails-on-Ubuntu-11-04-amd-64-td3580407.html

最新のブースト バージョンをテストしたところ、これもコンパイルされません。

于 2012-03-04T13:33:43.263 に答える