Boost logo

Boost Users :

Subject: [Boost-users] indirect_iterator,symmetric_matrix and ptr_vector
From: Archie14 (admin_at_[hidden])
Date: 2009-05-27 06:57:20


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<double, lower> 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<T,TRI>'
        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<double,boost::numeric::ublas::lower>
        ]
        c:\Libraries\boost\boost_1_39_0\boost/pointee.hpp(69) : see reference
to class template instantiation 'boost::mpl::eval_if<C,F1,F2>' being compiled
        with
        [
            
C=boost::detail::is_incrementable<boost::numeric::ublas::symmetric_matrix<doubl
e,boost::numeric::ublas::lower>>,
            
F1=boost::detail::iterator_pointee<boost::numeric::ublas::symmetric_matrix<doub
le,boost::numeric::ublas::lower>>,
..
etc.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net