4 * \file iterator_type.hpp
6 * \brief Iterator to a given container type.
8 * Copyright (c) 2009, Marco Guazzone
10 * Distributed under the Boost Software License, Version 1.0. (See
11 * accompanying file LICENSE_1_0.txt or copy at
12 * http://www.boost.org/LICENSE_1_0.txt)
14 * \author Marco Guazzone, marco.guazzone@gmail.com
18 #ifndef BOOST_NUMERIC_UBLAS_TRAITS_ITERATOR_TYPE_HPP
19 #define BOOST_NUMERIC_UBLAS_TRAITS_ITERATOR_TYPE_HPP
22 #include <boost/numeric/ublas/fwd.hpp>
23 #include <boost/numeric/ublas/traits.hpp>
24 #include <boost/numeric/ublas/tags.hpp>
27 namespace boost { namespace numeric { namespace ublas {
32 * \brief Auxiliary class for retrieving the iterator to the given
33 * matrix expression according its orientation and to the given dimension tag.
34 * \tparam MatrixT A model of MatrixExpression.
35 * \tparam TagT A dimension tag type (e.g., tag::major).
36 * \tparam OrientationT An orientation category type (e.g., row_major_tag).
38 template <typename MatrixT, typename TagT, typename OrientationT>
39 struct iterator_type_impl;
42 /// \brief Specialization of \c iterator_type_impl for row-major oriented
43 /// matrices and over the major dimension.
44 template <typename MatrixT>
45 struct iterator_type_impl<MatrixT,tag::major,row_major_tag>
47 typedef typename matrix_traits<MatrixT>::iterator1 type;
51 /// \brief Specialization of \c iterator_type_impl for column-major oriented
52 /// matrices and over the major dimension.
53 template <typename MatrixT>
54 struct iterator_type_impl<MatrixT,tag::major,column_major_tag>
56 typedef typename matrix_traits<MatrixT>::iterator2 type;
60 /// \brief Specialization of \c iterator_type_impl for row-major oriented
61 /// matrices and over the minor dimension.
62 template <typename MatrixT>
63 struct iterator_type_impl<MatrixT,tag::minor,row_major_tag>
65 typedef typename matrix_traits<MatrixT>::iterator2 type;
69 /// \brief Specialization of \c iterator_type_impl for column-major oriented
70 /// matrices and over the minor dimension.
71 template <typename MatrixT>
72 struct iterator_type_impl<MatrixT,tag::minor,column_major_tag>
74 typedef typename matrix_traits<MatrixT>::iterator1 type;
81 * \brief A iterator for the given container type over the given dimension.
82 * \tparam ContainerT A container expression type.
83 * \tparam TagT A dimension tag type (e.g., tag::major).
85 template <typename ContainerT, typename TagT=void>
90 * \brief Specialization of \c iterator_type for vector expressions.
91 * \tparam VectorT A model of VectorExpression type.
93 template <typename VectorT>
94 struct iterator_type<VectorT, void>
96 typedef typename vector_traits<VectorT>::iterator type;
101 * \brief Specialization of \c iterator_type for matrix expressions and
102 * over the major dimension.
103 * \tparam MatrixT A model of MatrixExpression type.
105 template <typename MatrixT>
106 struct iterator_type<MatrixT,tag::major>
108 typedef typename detail::iterator_type_impl<MatrixT,tag::major,typename matrix_traits<MatrixT>::orientation_category>::type type;
113 * \brief Specialization of \c iterator_type for matrix expressions and
114 * over the minor dimension.
115 * \tparam MatrixT A model of MatrixExpression type.
117 template <typename MatrixT>
118 struct iterator_type<MatrixT,tag::minor>
120 typedef typename detail::iterator_type_impl<MatrixT,tag::minor,typename matrix_traits<MatrixT>::orientation_category>::type type;
123 }}} // Namespace boost::numeric::ublas
126 #endif // BOOST_NUMERIC_UBLAS_TRAITS_ITERATOR_TYPE_HPP