Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56600 - in trunk/boost/numeric/ublas: . traits
From: guwi17_at_[hidden]
Date: 2009-10-05 16:44:08


Author: guwi17
Date: 2009-10-05 16:44:06 EDT (Mon, 05 Oct 2009)
New Revision: 56600
URL: http://svn.boost.org/trac/boost/changeset/56600

Log:
see #3449: introduce new free functions to access matrix/vector properties (Incomplete)

 * move experimental traits of T[N] and T[M][N] to separate file
Added:
   trunk/boost/numeric/ublas/traits/
   trunk/boost/numeric/ublas/traits/c_array.hpp (contents, props changed)
Text files modified:
   trunk/boost/numeric/ublas/traits.hpp | 59 ---------------------------------------
   1 files changed, 1 insertions(+), 58 deletions(-)

Modified: trunk/boost/numeric/ublas/traits.hpp
==============================================================================
--- trunk/boost/numeric/ublas/traits.hpp (original)
+++ trunk/boost/numeric/ublas/traits.hpp 2009-10-05 16:44:06 EDT (Mon, 05 Oct 2009)
@@ -647,64 +647,7 @@
     };
 
 
-
- template < class T, int M, int N >
- struct matrix_traits < T[M][N] > {
- typedef T matrix_type[M][N];
-
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
-
- typedef row_major_tag orientation_category;
- typedef dense_tag storage_category;
-
- typedef T value_type;
- typedef T *reference;
- typedef const T *const_reference;
-
- // \todo { define correct wrapper }
- typedef matrix_reference<matrix_type> closure_type;
- typedef const matrix_reference<const matrix_type> const_closure_type;
-
- // \todo { define appropriate iterators }
- };
-
- template < class T, int N >
- struct vector_view_traits < T[N] > {
- typedef T vector_type[N];
-
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
-
- typedef dense_tag storage_category;
-
- typedef T value_type;
- typedef const T *const_reference;
-
- // \todo { define correct wrapper }
- typedef const vector_reference<const vector_type> const_closure_type;
-
- typedef const_reference const_iterator;
-
- /// iterator pointing to the first element
- static
- const_iterator begin(const vector_type & v) {
- return & (v[0]);
- }
- /// iterator pointing behind the last element
- static
- const_iterator end(const vector_type & v) {
- return & (v[N]);
- }
- };
-
- template < class T, int N >
- struct mutable_vector_traits < T[N] > {
-
- typedef T *reference;
- typedef vector_reference< T[N] > closure_type;
-
- };
+ // Note: specializations for T[N] and T[M][N] have been moved to traits/c_array.hpp
 
 }}}
 

Added: trunk/boost/numeric/ublas/traits/c_array.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/ublas/traits/c_array.hpp 2009-10-05 16:44:06 EDT (Mon, 05 Oct 2009)
@@ -0,0 +1,110 @@
+/**
+ * -*- c++ -*-
+ *
+ * \file c_array.hpp
+ *
+ * \brief provides specializations of matrix and vector traits for c arrays and c matrices.
+ *
+ * Copyright (c) 2009, Gunter Winkler
+ *
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * \author Gunter Winkler (guwi17 at gmx dot de)
+ */
+
+#ifndef BOOST_NUMERIC_UBLAS_TRAITS_C_ARRAY_HPP
+#define BOOST_NUMERIC_UBLAS_TRAITS_C_ARRAY_HPP
+
+
+#include <boost/numeric/ublas/traits.hpp>
+#include <boost/numeric/ublas/traits/const_iterator_type.hpp>
+#include <boost/numeric/ublas/traits/iterator_type.hpp>
+
+namespace boost { namespace numeric { namespace ublas {
+
+ namespace detail {
+
+
+
+ }
+
+
+ template < class T, int M, int N >
+ struct matrix_view_traits < T[M][N] > {
+ typedef T matrix_type[M][N];
+
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+
+ typedef row_major_tag orientation_category;
+ typedef dense_tag storage_category;
+
+ typedef T value_type;
+ typedef const T &const_reference;
+ typedef const T *const_pointer;
+
+ typedef const matrix_reference<const matrix_type> const_closure_type;
+
+ typedef T row_type[N];
+
+ typedef const row_type *const_iterator1;
+ typedef const_pointer const_iterator2;
+
+ };
+
+ template < class T, int M, int N >
+ struct mutable_matrix_traits < T[M][N] > {
+ typedef T matrix_type[M][N];
+
+ typedef T *reference;
+
+ typedef matrix_reference<matrix_type> closure_type;
+
+ };
+
+ template < class T, int N >
+ struct vector_view_traits < T[N] > {
+ typedef T vector_type[N];
+
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+
+ typedef dense_tag storage_category;
+
+ typedef T value_type;
+ typedef const T &const_reference;
+ typedef const T *const_pointer;
+
+ typedef const vector_reference<const vector_type> const_closure_type;
+
+ typedef const_pointer const_iterator;
+
+ /// iterator pointing to the first element
+ static
+ const_iterator begin(const vector_type & v) {
+ return & (v[0]);
+ }
+ /// iterator pointing behind the last element
+ static
+ const_iterator end(const vector_type & v) {
+ return & (v[N]);
+ }
+ };
+
+ template < class T, int N >
+ struct mutable_vector_traits < T[N] > {
+
+ typedef T &reference;
+ typedef T *pointer;
+ typedef vector_reference< T[N] > closure_type;
+
+ };
+
+
+
+
+}}} // Namespace boost::numeric::ublas
+
+#endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk