|
Ublas : |
Subject: [ublas] problem with gcc > 4.4
From: Nuno Sucena Almeida (slug_at_[hidden])
Date: 2011-11-21 12:18:05
Hi,
is there a fix for the following compilation error ? It only happens
with gcc versions higher than 4.4. Thanks,
Nuno
~$ cat t1.cc #include <boost/numeric/ublas/matrix_sparse.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
coordinate_matrix<double> m (3, 3, 3 * 3);
for (unsigned i = 0; i < m.size1 (); ++ i)
for (unsigned j = 0; j < m.size2 (); ++ j)
m (i, j) = 3 * i + j;
std::cout << m << std::endl;
}
~$ g++ t1.cc -I /opt/boost/1.48.0/include/
In file included from /usr/include/c++/4.6/bits/stl_algo.h:64:0,
from /usr/include/c++/4.6/algorithm:63,
from /opt/boost/1.48.0/include/boost/utility/swap.hpp:24,
from /opt/boost/1.48.0/include/boost/swap.hpp:10,
from /opt/boost/1.48.0/include/boost/array.hpp:44,
from
/opt/boost/1.48.0/include/boost/serialization/array.hpp:26,
from
/opt/boost/1.48.0/include/boost/numeric/ublas/storage_sparse.hpp:19,
from
/opt/boost/1.48.0/include/boost/numeric/ublas/vector_sparse.hpp:16,
from
/opt/boost/1.48.0/include/boost/numeric/ublas/matrix_sparse.hpp:16,
from t1.cc:1:
/usr/include/c++/4.6/bits/stl_tempbuf.h: In constructor
std::_Temporary_buffer<_ForwardIterator,
_Tp>::_Temporary_buffer(_ForwardIterator, _ForwardIterator) [with
_ForwardIterator =
boost::numeric::ublas::indexed_iterator<boost::numeric::ublas::index_triple_array<boost::numeric::ublas::unbounded_array<long
unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned
int>, boost::numeric::ublas::unbounded_array<double,
std::allocator<double> > >, std::random_access_iterator_tag>, _Tp =
boost::numeric::ublas::index_triple<boost::numeric::ublas::index_triple_array<boost::numeric::ublas::unbounded_array<long
unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned
int>, boost::numeric::ublas::unbounded_array<double,
std::allocator<double> > > >]:
/usr/include/c++/4.6/bits/stl_algo.h:3123:17: instantiated from void
std::inplace_merge(_BIter, _BIter, _BIter) [with _BIter =
boost::numeric::ublas::indexed_iterator<boost::numeric::ublas::index_triple_array<boost::numeric::ublas::unbounded_array<long
unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned
int>, boost::numeric::ublas::unbounded_array<double,
std::allocator<double> > >, std::random_access_iterator_tag>]
/opt/boost/1.48.0/include/boost/numeric/ublas/matrix_sparse.hpp:4403:17:
instantiated from void boost::numeric::ublas::coordinate_matrix<T, L,
IB, IA, TA>::sort() const [with T = double, L =
boost::numeric::ublas::basic_row_major<>, long unsigned int IB = 0ul, IA
= boost::numeric::ublas::unbounded_array<long unsigned int>, TA =
boost::numeric::ublas::unbounded_array<double, std::allocator<double> >]
/opt/boost/1.48.0/include/boost/numeric/ublas/matrix_sparse.hpp:4190:13:
instantiated from const T*
boost::numeric::ublas::coordinate_matrix<T, L, IB, IA,
TA>::find_element(boost::numeric::ublas::coordinate_matrix<T, L, IB, IA,
TA>::size_type, boost::numeric::ublas::coordinate_matrix<T, L, IB, IA,
TA>::size_type) const [with T = double, L =
boost::numeric::ublas::basic_row_major<>, long unsigned int IB = 0ul, IA
= boost::numeric::ublas::unbounded_array<long unsigned int>, TA =
boost::numeric::ublas::unbounded_array<double, std::allocator<double> >,
boost::numeric::ublas::coordinate_matrix<T, L, IB, IA,
TA>::const_pointer = const double*,
boost::numeric::ublas::coordinate_matrix<T, L, IB, IA, TA>::size_type =
long unsigned int]
/opt/boost/1.48.0/include/boost/numeric/ublas/matrix_sparse.hpp:4208:49:
instantiated from const T&
boost::numeric::ublas::coordinate_matrix<T, L, IB, IA,
TA>::operator()(boost::numeric::ublas::coordinate_matrix<T, L, IB, IA,
TA>::size_type, boost::numeric::ublas::coordinate_matrix<T, L, IB, IA,
TA>::size_type) const [with T = double, L =
boost::numeric::ublas::basic_row_major<>, long unsigned int IB = 0ul, IA
= boost::numeric::ublas::unbounded_array<long unsigned int>, TA =
boost::numeric::ublas::unbounded_array<double, std::allocator<double> >,
boost::numeric::ublas::coordinate_matrix<T, L, IB, IA,
TA>::const_reference = const double&,
boost::numeric::ublas::coordinate_matrix<T, L, IB, IA, TA>::size_type =
long unsigned int]
/opt/boost/1.48.0/include/boost/numeric/ublas/io.hpp:163:17:
instantiated from std::basic_ostream<_CharT, _Traits>&
boost::numeric::ublas::operator<<(std::basic_ostream<_CharT, _Traits>&,
const boost::numeric::ublas::matrix_expression<E2>&) [with E = char, T =
std::char_traits<char>, ME =
boost::numeric::ublas::coordinate_matrix<double>]
t1.cc:10:18: 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::index_triple_array<boost::numeric::ublas::unbounded_array<long
unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned
int>, boost::numeric::ublas::unbounded_array<double,
std::allocator<double> > > >& from an rvalue of type
boost::numeric::ublas::indexed_iterator<boost::numeric::ublas::index_triple_array<boost::numeric::ublas::unbounded_array<long
unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned
int>, boost::numeric::ublas::unbounded_array<double,
std::allocator<double> > >, std::random_access_iterator_tag>::reference
{aka
boost::numeric::ublas::index_triple<boost::numeric::ublas::index_triple_array<boost::numeric::ublas::unbounded_array<long
unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned
int>, boost::numeric::ublas::unbounded_array<double, std::allocator<d
ouble> > > >}
/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::index_triple_array<boost::numeric::ublas::unbounded_array<long
unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned
int>, boost::numeric::ublas::unbounded_array<double,
std::allocator<double> > > >*, _Tp =
boost::numeric::ublas::index_triple<boost::numeric::ublas::index_triple_array<boost::numeric::ublas::unbounded_array<long
unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned
int>, boost::numeric::ublas::unbounded_array<double,
std::allocator<double> > > >]
-- http://slug.aeminium.org/