toon-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Toon-members] TooN TooN.h doc/matrixdoc.h internal/mbase.hh


From: Edward Rosten
Subject: [Toon-members] TooN TooN.h doc/matrixdoc.h internal/mbase.hh
Date: Fri, 22 May 2009 10:31:44 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Edward Rosten <edrosten>        09/05/22 10:31:43

Modified files:
        .              : TooN.h 
        doc            : matrixdoc.h 
        internal       : mbase.hh 

Log message:
        Added indexing using a std::pair<int, int> in operator[].

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/TooN.h?cvsroot=toon&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/TooN/doc/matrixdoc.h?cvsroot=toon&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/mbase.hh?cvsroot=toon&r1=1.31&r2=1.32

Patches:
Index: TooN.h
===================================================================
RCS file: /cvsroot/toon/TooN/TooN.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- TooN.h      18 May 2009 12:10:34 -0000      1.42
+++ TooN.h      22 May 2009 10:31:42 -0000      1.43
@@ -35,6 +35,7 @@
 #include <cstdlib>
 #include <limits>
 #include <new>
+#include <utility>
 #include <TooN/internal/config.hh>
 #include <TooN/internal/typeof.hh>
 #include <TooN/internal/deprecated.hh>

Index: doc/matrixdoc.h
===================================================================
RCS file: /cvsroot/toon/TooN/doc/matrixdoc.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- doc/matrixdoc.h     14 Apr 2009 07:12:37 -0000      1.9
+++ doc/matrixdoc.h     22 May 2009 10:31:43 -0000      1.10
@@ -177,6 +177,14 @@
   
   /**
   Access an element from the matrix.
+  @param row_col <code>row_col.first</code> holds the row, 
<code>row_col.second</code> holds the column.
+  */
+  const double& operator[](const std::pair<int,int>& row_col) const;
+  ///@overload
+  double& operator[](const std::pair<int,int>& row_col);
+  
+  /**
+  Access an element from the matrix.
   This can be used as either an r-value or an l-value. The index starts at 
zero,
   i.e. the top-left element is m(0, 0).
   @code

Index: internal/mbase.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/mbase.hh,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- internal/mbase.hh   6 May 2009 14:51:18 -0000       1.31
+++ internal/mbase.hh   22 May 2009 10:31:43 -0000      1.32
@@ -139,6 +139,14 @@
                return my_data[r*rowstride() + c*colstride()];
        }
 
+       Precision& operator[](const std::pair<int, int>& index) {
+               return (*this)(index.first, index.second);
+       }
+
+       const Precision& operator[](const std::pair<int, int>& index) const {
+               return (*this)(index.first, index.second);
+       }
+
        // this is the type of vector obtained by [ ]
        typedef Vector<Cols, Precision, SliceVBase<SliceColStride> > Vec;
        




reply via email to

[Prev in Thread] Current Thread [Next in Thread]