diff --git a/include/boost/numeric/ublas/matrix_proxy.hpp b/include/boost/numeric/ublas/matrix_proxy.hpp index f2fc8e2f..bfd11ea4 100644 --- a/include/boost/numeric/ublas/matrix_proxy.hpp +++ b/include/boost/numeric/ublas/matrix_proxy.hpp @@ -65,15 +65,6 @@ namespace boost { namespace numeric { namespace ublas { typedef matrix_row self_type; typedef const_self_type const_closure_type; typedef self_type closure_type; -#ifndef BOOST_UBLAS_CT_PROXY_BASE_TYPEDEFS - typedef typename M::const_iterator2 const_iterator_type; - typedef typename M::iterator2 iterator_type; -#else - typedef typename M::const_iterator2 const_iterator_type; - typedef typename boost::mpl::if_c::value, - typename M::const_iterator2, - typename M::iterator2>::type iterator_type; -#endif typedef typename storage_restrict_traits::storage_category storage_category; @@ -230,6 +221,20 @@ namespace boost { namespace numeric { namespace ublas { } #endif + // Iterator types + private: +#ifndef BOOST_UBLAS_CT_PROXY_BASE_TYPEDEFS + // Reuse the matrix iterator + typedef typename M::const_iterator2 const_iterator_type; + typedef typename M::iterator2 iterator_type; +#else + typedef typename M::const_iterator2 const_iterator_type; + typedef typename boost::mpl::if_c::value, + typename M::const_iterator2, + typename M::iterator2>::type iterator_type; +#endif + + public: #ifdef BOOST_UBLAS_USE_INDEXED_ITERATOR typedef indexed_iterator, BOOST_UBLAS_TYPENAME iterator_type::iterator_category> iterator; @@ -260,8 +265,6 @@ namespace boost { namespace numeric { namespace ublas { #endif } - // Iterators simply are pointers. - #ifndef BOOST_UBLAS_USE_INDEXED_ITERATOR class const_iterator: public container_const_reference, @@ -571,15 +574,6 @@ namespace boost { namespace numeric { namespace ublas { typedef matrix_column self_type; typedef const_self_type const_closure_type; typedef self_type closure_type; -#ifndef BOOST_UBLAS_CT_PROXY_BASE_TYPEDEFS - typedef typename M::const_iterator1 const_iterator_type; - typedef typename M::iterator1 iterator_type; -#else - typedef typename M::const_iterator1 const_iterator_type; - typedef typename boost::mpl::if_c::value, - typename M::const_iterator1, - typename M::iterator1>::type iterator_type; -#endif typedef typename storage_restrict_traits::storage_category storage_category; @@ -736,6 +730,20 @@ namespace boost { namespace numeric { namespace ublas { } #endif + // Iterator types + private: +#ifndef BOOST_UBLAS_CT_PROXY_BASE_TYPEDEFS + // Reuse the matrix iterator + typedef typename M::const_iterator1 const_iterator_type; + typedef typename M::iterator1 iterator_type; +#else + typedef typename M::const_iterator1 const_iterator_type; + typedef typename boost::mpl::if_c::value, + typename M::const_iterator1, + typename M::iterator1>::type iterator_type; +#endif + + public: #ifdef BOOST_UBLAS_USE_INDEXED_ITERATOR typedef indexed_iterator, BOOST_UBLAS_TYPENAME iterator_type::iterator_category> iterator; @@ -1077,10 +1085,6 @@ namespace boost { namespace numeric { namespace ublas { typedef matrix_vector_range self_type; typedef const_self_type const_closure_type; typedef self_type closure_type; - typedef range::const_iterator const_iterator1_type; - typedef range::const_iterator iterator1_type; - typedef range::const_iterator const_iterator2_type; - typedef range::const_iterator iterator2_type; typedef typename storage_restrict_traits::storage_category storage_category; @@ -1245,6 +1249,15 @@ namespace boost { namespace numeric { namespace ublas { } #endif + // Iterator types + private: + // Use range as an index - FIXME this fails for packed assignment + typedef range::const_iterator const_iterator1_type; + typedef range::const_iterator iterator1_type; + typedef range::const_iterator const_iterator2_type; + typedef range::const_iterator iterator2_type; + + public: class const_iterator; class iterator; @@ -1258,8 +1271,6 @@ namespace boost { namespace numeric { namespace ublas { return iterator (*this, r1_.begin () + i, r2_.begin () + i); } - // Iterators simply are indices. - class const_iterator: public container_const_reference, #ifndef BOOST_UBLAS_NO_ITERATOR_BASE_TRAITS @@ -1571,10 +1582,6 @@ namespace boost { namespace numeric { namespace ublas { typedef matrix_vector_slice self_type; typedef const_self_type const_closure_type; typedef self_type closure_type; - typedef slice::const_iterator const_iterator1_type; - typedef slice::const_iterator iterator1_type; - typedef slice::const_iterator const_iterator2_type; - typedef slice::const_iterator iterator2_type; typedef typename storage_restrict_traits::storage_category storage_category; @@ -1746,6 +1753,15 @@ namespace boost { namespace numeric { namespace ublas { } #endif + // Iterator types + private: + // Use slice as an index - FIXME this fails for packed assignment + typedef slice::const_iterator const_iterator1_type; + typedef slice::const_iterator iterator1_type; + typedef slice::const_iterator const_iterator2_type; + typedef slice::const_iterator iterator2_type; + + public: class const_iterator; class iterator; @@ -2073,10 +2089,6 @@ namespace boost { namespace numeric { namespace ublas { typedef matrix_vector_indirect self_type; typedef const_self_type const_closure_type; typedef self_type closure_type; - typedef typename IA::const_iterator const_iterator1_type; - typedef typename IA::const_iterator iterator1_type; - typedef typename IA::const_iterator const_iterator2_type; - typedef typename IA::const_iterator iterator2_type; typedef typename storage_restrict_traits::storage_category storage_category; @@ -2248,6 +2260,15 @@ namespace boost { namespace numeric { namespace ublas { } #endif + // Iterator types + private: + // Use indirect array as an index - FIXME this fails for packed assignment + typedef typename IA::const_iterator const_iterator1_type; + typedef typename IA::const_iterator iterator1_type; + typedef typename IA::const_iterator const_iterator2_type; + typedef typename IA::const_iterator iterator2_type; + + public: class const_iterator; class iterator; @@ -2574,21 +2595,6 @@ namespace boost { namespace numeric { namespace ublas { typedef matrix_range self_type; typedef const_self_type const_closure_type; typedef self_type closure_type; -#ifndef BOOST_UBLAS_CT_PROXY_BASE_TYPEDEFS - typedef typename M::const_iterator1 const_iterator1_type; - typedef typename M::iterator1 iterator1_type; - typedef typename M::const_iterator2 const_iterator2_type; - typedef typename M::iterator2 iterator2_type; -#else - typedef typename M::const_iterator1 const_iterator1_type; - typedef typename boost::mpl::if_c::value, - typename M::const_iterator1, - typename M::iterator1>::type iterator1_type; - typedef typename M::const_iterator2 const_iterator2_type; - typedef typename boost::mpl::if_c::value, - typename M::const_iterator2, - typename M::iterator2>::type iterator2_type; -#endif typedef typename storage_restrict_traits::storage_category storage_category; typedef typename M::orientation_category orientation_category; @@ -2751,6 +2757,26 @@ namespace boost { namespace numeric { namespace ublas { } #endif + // Iterator types + private: +#ifndef BOOST_UBLAS_CT_PROXY_BASE_TYPEDEFS + // Reuse the matrix iterator + typedef typename M::const_iterator1 const_iterator1_type; + typedef typename M::iterator1 iterator1_type; + typedef typename M::const_iterator2 const_iterator2_type; + typedef typename M::iterator2 iterator2_type; +#else + typedef typename M::const_iterator1 const_iterator1_type; + typedef typename boost::mpl::if_c::value, + typename M::const_iterator1, + typename M::iterator1>::type iterator1_type; + typedef typename M::const_iterator2 const_iterator2_type; + typedef typename boost::mpl::if_c::value, + typename M::const_iterator2, + typename M::iterator2>::type iterator2_type; +#endif + + public: #ifdef BOOST_UBLAS_USE_INDEXED_ITERATOR typedef indexed_iterator1, BOOST_UBLAS_TYPENAME iterator1_type::iterator_category> iterator1; @@ -3493,10 +3519,6 @@ namespace boost { namespace numeric { namespace ublas { typedef matrix_slice self_type; typedef const_self_type const_closure_type; typedef self_type closure_type; - typedef slice::const_iterator const_iterator1_type; - typedef slice::const_iterator iterator1_type; - typedef slice::const_iterator const_iterator2_type; - typedef slice::const_iterator iterator2_type; typedef typename storage_restrict_traits::storage_category storage_category; typedef typename M::orientation_category orientation_category; @@ -3671,6 +3693,15 @@ namespace boost { namespace numeric { namespace ublas { } #endif + // Iterator types + private: + // Use slice as an index - FIXME this fails for packed assignment + typedef slice::const_iterator const_iterator1_type; + typedef slice::const_iterator iterator1_type; + typedef slice::const_iterator const_iterator2_type; + typedef slice::const_iterator iterator2_type; + + public: #ifdef BOOST_UBLAS_USE_INDEXED_ITERATOR typedef indexed_iterator1, BOOST_UBLAS_TYPENAME matrix_type::iterator1::iterator_category> iterator1; @@ -4438,10 +4469,6 @@ namespace boost { namespace numeric { namespace ublas { typedef matrix_indirect self_type; typedef const_self_type const_closure_type; typedef self_type closure_type; - typedef typename IA::const_iterator const_iterator1_type; - typedef typename IA::const_iterator iterator1_type; - typedef typename IA::const_iterator const_iterator2_type; - typedef typename IA::const_iterator iterator2_type; typedef typename storage_restrict_traits::storage_category storage_category; typedef typename M::orientation_category orientation_category; @@ -4611,6 +4638,14 @@ namespace boost { namespace numeric { namespace ublas { } #endif + // Iterator types + private: + typedef typename IA::const_iterator const_iterator1_type; + typedef typename IA::const_iterator iterator1_type; + typedef typename IA::const_iterator const_iterator2_type; + typedef typename IA::const_iterator iterator2_type; + + public: #ifdef BOOST_UBLAS_USE_INDEXED_ITERATOR typedef indexed_iterator1, BOOST_UBLAS_TYPENAME matrix_type::iterator1::iterator_category> iterator1; diff --git a/include/boost/numeric/ublas/vector_proxy.hpp b/include/boost/numeric/ublas/vector_proxy.hpp index 8775e89c..5a78c4e9 100644 --- a/include/boost/numeric/ublas/vector_proxy.hpp +++ b/include/boost/numeric/ublas/vector_proxy.hpp @@ -64,15 +64,6 @@ namespace boost { namespace numeric { namespace ublas { typedef vector_range self_type; typedef const_self_type const_closure_type; typedef self_type closure_type; -#ifndef BOOST_UBLAS_CT_PROXY_BASE_TYPEDEFS - typedef typename V::const_iterator const_iterator_type; - typedef typename V::iterator iterator_type; -#else - typedef typename V::const_iterator const_iterator_type; - typedef typename boost::mpl::if_c::value, - typename V::const_iterator, - typename V::iterator>::type iterator_type; -#endif typedef typename storage_restrict_traits::storage_category storage_category; @@ -242,6 +233,20 @@ namespace boost { namespace numeric { namespace ublas { } #endif + // Iterator types + private: +#ifndef BOOST_UBLAS_CT_PROXY_BASE_TYPEDEFS + // Reuse the vector iterator + typedef typename V::const_iterator const_iterator_type; + typedef typename V::iterator iterator_type; +#else + typedef typename V::const_iterator const_iterator_type; + typedef typename boost::mpl::if_c::value, + typename V::const_iterator, + typename V::iterator>::type iterator_type; +#endif + + public: #ifdef BOOST_UBLAS_USE_INDEXED_ITERATOR typedef indexed_iterator, BOOST_UBLAS_TYPENAME iterator_type::iterator_category> iterator; @@ -272,8 +277,6 @@ namespace boost { namespace numeric { namespace ublas { #endif } - // Iterators simply are pointers. - #ifndef BOOST_UBLAS_USE_INDEXED_ITERATOR class const_iterator: public container_const_reference, @@ -593,8 +596,6 @@ namespace boost { namespace numeric { namespace ublas { typedef vector_slice self_type; typedef const vector_slice const_closure_type; typedef vector_slice closure_type; - typedef slice::const_iterator const_iterator_type; - typedef slice::const_iterator iterator_type; typedef typename storage_restrict_traits::storage_category storage_category; @@ -772,6 +773,13 @@ return true; } #endif + // Iterator types + private: + // Use slice as an index - FIXME this fails for packed assignment + typedef slice::const_iterator const_iterator_type; + typedef slice::const_iterator iterator_type; + + public: #ifdef BOOST_UBLAS_USE_INDEXED_ITERATOR typedef indexed_iterator, BOOST_UBLAS_TYPENAME vector_type::iterator::iterator_category> iterator; @@ -800,8 +808,6 @@ return true; #endif } - // Iterators simply are indices. - #ifndef BOOST_UBLAS_USE_INDEXED_ITERATOR class const_iterator: public container_const_reference, @@ -1138,8 +1144,6 @@ return true; typedef vector_indirect self_type; typedef const_self_type const_closure_type; typedef self_type closure_type; - typedef typename IA::const_iterator const_iterator_type; - typedef typename IA::const_iterator iterator_type; typedef typename storage_restrict_traits::storage_category storage_category; @@ -1316,6 +1320,13 @@ return true; } #endif + // Iterator types + private: + // Use indirect array as an index - FIXME this fails for packed assignment + typedef typename IA::const_iterator const_iterator_type; + typedef typename IA::const_iterator iterator_type; + + public: #ifdef BOOST_UBLAS_USE_INDEXED_ITERATOR typedef indexed_iterator, BOOST_UBLAS_TYPENAME vector_type::iterator::iterator_category> iterator; @@ -1325,7 +1336,6 @@ return true; class const_iterator; class iterator; #endif - // Element lookup BOOST_UBLAS_INLINE const_iterator find (size_type i) const {