6 * \brief provides specializations of matrix and vector traits for c arrays and c matrices.
8 * Copyright (c) 2009, Gunter Winkler
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 Gunter Winkler (guwi17 at gmx dot de)
17 #ifndef BOOST_NUMERIC_UBLAS_TRAITS_C_ARRAY_HPP
18 #define BOOST_NUMERIC_UBLAS_TRAITS_C_ARRAY_HPP
21 #include <boost/numeric/ublas/traits.hpp>
22 #include <boost/numeric/ublas/traits/const_iterator_type.hpp>
23 #include <boost/numeric/ublas/traits/iterator_type.hpp>
25 namespace boost { namespace numeric { namespace ublas {
34 template < class T, int M, int N >
35 struct matrix_view_traits < T[M][N] > {
36 typedef T matrix_type[M][N];
38 typedef std::size_t size_type;
39 typedef std::ptrdiff_t difference_type;
41 typedef row_major_tag orientation_category;
42 typedef dense_tag storage_category;
45 typedef const T &const_reference;
46 typedef const T *const_pointer;
48 typedef const matrix_reference<const matrix_type> const_closure_type;
50 typedef T row_type[N];
52 typedef const row_type *const_iterator1;
53 typedef const_pointer const_iterator2;
57 template < class T, int M, int N >
58 struct mutable_matrix_traits < T[M][N] > {
59 typedef T matrix_type[M][N];
63 typedef matrix_reference<matrix_type> closure_type;
67 template < class T, int N >
68 struct vector_view_traits < T[N] > {
69 typedef T vector_type[N];
71 typedef std::size_t size_type;
72 typedef std::ptrdiff_t difference_type;
74 typedef dense_tag storage_category;
77 typedef const T &const_reference;
78 typedef const T *const_pointer;
80 typedef const vector_reference<const vector_type> const_closure_type;
82 typedef const_pointer const_iterator;
84 /// iterator pointing to the first element
86 const_iterator begin(const vector_type & v) {
89 /// iterator pointing behind the last element
91 const_iterator end(const vector_type & v) {
96 template < class T, int N >
97 struct mutable_vector_traits < T[N] > {
101 typedef vector_reference< T[N] > closure_type;
108 }}} // Namespace boost::numeric::ublas