iterator.h

来自「高效的c++科学算法库」· C头文件 代码 · 共 85 行

H
85
字号
/*                                           -*- c++ -*- ****************************** * Scientific Library (GNU Public Licence) * * Author: Laurent Deniau, Laurent.Deniau@cern.ch * * $Id: iterator.h,v 1.1 1998/11/05 12:48:38 paubert Exp $ * * Suggestions: sl@mathinsa.insa-lyon.fr * Bugs:   sl-bugs@mathinsa.insa-lyon.fr * * For more information, please see the sl++ Home Page: * http://wwwinfo.cern.ch/~ldeniau/sl.html * ****************************** */#ifndef SL_MATRIX_STRUCTURES_ROWMAJOR_ITERATOR_H#define SL_MATRIX_STRUCTURES_ROWMAJOR_ITERATOR_H#ifndef SL_MATRIX_STRUCTURES_ROWMAJOR_H#error <sl/matrix/structures/rowmajor/iterator.h> must be included via <sl/matrix/structures/rowmajor.h>#endif#ifdef HAVE_NAMESPACEnamespace sl {#endif      /** @memo Iterator: Row Major Storage       */    class RowMajorIterator : public GeneralIterator {    public:        typedef RowMajor structure_t;          /**@name constructor */          //@{          /// constructor        RowMajorIterator( structure_t const* structure,                          Index const i =MinIndex,                          Index const j =MinIndex )            : GeneralIterator( structure->rows(),                               structure->cols(),                               i, j,                               structure->cols()*i+j ) {}          //@}          /**@name member */          //@{          /// doc        void        operator ++ () {            if (++my_j > my_p) {                my_j = MinIndex;                if (++my_i > my_n) my_ok = false;            }            ++my_o;        }          /// doc        void        incRow() {            if (++my_i > my_n) my_ok = false;            else my_o += my_p;        }          /// doc        void        incCol() {            if (++my_j > my_p) my_ok = false;            else ++my_o;        }          //@}    };#ifdef HAVE_NAMESPACE}#endif #endif// SL_MATRIX_STRUCTURES_ROWMAJOR_ROWMAJOR_H

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?