indirect_iterator,symmetric_matrix and ptr_vector
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.
Archie14 skrev:
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.
pointer containers already use indirect iterators by default. -Thorsten
participants (2)
-
Archie14
-
Thorsten Ottosen