STK++ 0.9.13
STK_InnerIteratorBase.h
Go to the documentation of this file.
1
2/*--------------------------------------------------------------------*/
3/* Copyright (C) 2004-2016 Serge Iovleff, Université Lille 1, Inria
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this program; if not, write to the
17 Free Software Foundation, Inc.,
18 59 Temple Place,
19 Suite 330,
20 Boston, MA 02111-1307
21 USA
22
23 Contact : S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
24*/
25
26/*
27 * Project: stkpp::Arrays
28 * created on: 28 marsh 2017
29 * Author: iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
30 **/
31
36#ifndef STK_INNERITERATORBASE_H
37#define STK_INNERITERATORBASE_H
38
39#include <iterator>
40
41#include <Sdk.h>
42
43namespace STK
44{
60template<class Array, class Derived>
62{
63 protected:
69 , row_(p_array->beginRows())
70 , col_(p_array->beginCols())
71 {}
82
83 public:
84 enum
85 {
92 };
93
96
99
101 inline int col() const {return col_;}
103 inline int row() const {return row_;}
104
106 inline Derived const& next() const { return this->asDerived().nextImpl();}
108 inline Derived const& prev() const { return this->asDerived().prevImpl();}
110 inline Derived const& operator++() const { return next();}
112 inline Derived const& operator++(int) const { return next();}
114 inline Derived const& operator--() const { return prev();}
116 inline Derived const& operator--(int) const { return prev();}
117
119 inline TypeConst value() const { return this->asDerived().valueImpl();}
121 inline reference valueRef() const { return this->asDerived().valueRefImpl();}
123 inline reference operator*() const { return value();}
125 inline pointer operator->() const { return &(value());}
126
127 protected:
129 Array* const p_array_;
131 mutable int row_;
133 mutable int col_;
134};
135
136
137} // namespace STK
138
139#endif /* STK_INNERITERATORBASE_H */
This file include all the other header files of the project Sdk.
Interface base class for all classes implementing the curious recursive template paradigm.
Derived & asDerived()
static cast : return a reference of this with a cast to the derived class.
InnerIteratorBase is a base class for all iterators on allocators.
reference valueRef() const
get current value of the iterator
pointer operator->() const
get address of the current element (the one at position pos_)
hidden::Traits< Array >::TypeConst TypeConst
Derived const & next() const
go to next position
Derived const & prev() const
go to previous position
hidden::RemoveConst< Type >::Type * pointer
Derived const & operator++(int) const
go to next position
InnerIteratorBase(InnerIteratorBase const &it)
copy constructor.
hidden::RemoveConst< Type >::Type & reference
InnerIteratorBase(Array *p_array)
default constructor.
Derived const & operator--(int) const
go to previous position
Derived const & operator--() const
go to previous position
int row_
current row position
Derived const & operator++() const
go to next position
reference operator*() const
get a reference on the current element (the one at position pos_)
TypeConst value() const
get current value of the iterator
Array *const p_array_
pointer on instance
hidden::Traits< Array >::Type Type
int col() const
get current column of the iterator
int col_
current column position
int row() const
get current row of the iterator
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
The namespace STK is the main domain space of the Statistical ToolKit project.