Following test fails to compile. Errors start with the first call to
make_indirect_iterator. On the first glace on the error output it looks that
indirect_iterators cannot be used together with ptr_vector and matrix. Is that
correct? If I need to calculate the sum of all matrices in a vector - what is
the right way to do it?
void test()
{
typedef symmetric_matrix matrixofdoubles;
boost::ptr_vector<matrixofdoubles> lst;
boost::make_indirect_iterator(lst.begin()); // testing ind.iter.
matrixofdoubles totalsum (10);
std::accumulate(
boost::make_indirect_iterator(lst.begin()),
boost::make_indirect_iterator(lst.end()),
totalsum, std::plus<matrixofdoubles>());
}
Errors are:
c:\Libraries\boost\boost_1_39_0\boost/pointee.hpp(30) : error
C2039: 'element_type' : is not a member
of 'boost::numeric::ublas::symmetric_matrix'
with
[
T=double,
TRI=boost::numeric::ublas::lower
]
c:\Libraries\boost\boost_1_39_0\boost/mpl/eval_if.hpp(41) : see
reference to class template
instantiation 'boost::detail::smart_ptr_pointee<P>' being compiled
with
[
P=boost::numeric::ublas::symmetric_matrix
]
c:\Libraries\boost\boost_1_39_0\boost/pointee.hpp(69) : see reference
to class template instantiation 'boost::mpl::eval_if' being compiled
with
[
C=boost::detail::is_incrementable>,
F1=boost::detail::iterator_pointee>,
..
etc.