我尝试compressed_matrix
使用 acoordinate_matrix
作为构建器创建一个:
#include <boost/numeric/ublas/io.hpp>
#include <boost/numeric/ublas/matrix_sparse.hpp>
using namespace boost::numeric::ublas;
int main(int argc, char** argv) {
coordinate_matrix<int> m1(100, 100, 100);
for (int i = 0; i < 100; i++)
m1.insert_element(i,i,i);
compressed_matrix<int> m2(m1, 100);
}
使用 boost 1.54 和 clang 似乎可以正常工作,但是当我使用 std=c++11 编译它时,会引发错误:
choeger@daishi /tmp % clang++ test.cpp --std=c++11
In file included from test.cpp:1:
In file included from /usr/include/boost/numeric/ublas/io.hpp:18:
In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2/sstream:38:
In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2/istream:38:
In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2/ios:40:
In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2/bits/char_traits.h:39:
/usr/bin/../lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2/bits/stl_algobase.h:147:7: error: no matching function for call to 'swap'
swap(*__a, *__b);
是否存在已知的 boost 1.54 与 C++11 的不兼容性?还是我犯了一些 C++11 错误?1.55 的更新日志没有提到 ublas 和矩阵,所以我猜它仍然存在。
这发生在 gcc 4.8.2 和 clang 3.4