Eigen  5.0.1-dev+master
 
Loading...
Searching...
No Matches
StlIterators.h
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2018 Gael Guennebaud <gael.guennebaud@inria.fr>
5//
6// This Source Code Form is subject to the terms of the Mozilla
7// Public License v. 2.0. If a copy of the MPL was not distributed
8// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9// SPDX-License-Identifier: MPL-2.0
10
11#ifndef EIGEN_STLITERATORS_H
12#define EIGEN_STLITERATORS_H
13
14// IWYU pragma: private
15#include "./InternalHeaderCheck.h"
16
17namespace Eigen {
18
19namespace internal {
20
21template <typename IteratorType>
22struct indexed_based_stl_iterator_traits;
23
24template <typename Derived>
25class indexed_based_stl_iterator_base {
26 protected:
27 using traits = indexed_based_stl_iterator_traits<Derived>;
28 using XprType = typename traits::XprType;
29 using non_const_iterator = indexed_based_stl_iterator_base<typename traits::non_const_iterator>;
30 using const_iterator = indexed_based_stl_iterator_base<typename traits::const_iterator>;
31 using other_iterator = std::conditional_t<std::is_const<XprType>::value, non_const_iterator, const_iterator>;
32
33 friend class indexed_based_stl_iterator_base<typename traits::const_iterator>;
34 friend class indexed_based_stl_iterator_base<typename traits::non_const_iterator>;
35
36 public:
37 using difference_type = Index;
38 using iterator_category = std::random_access_iterator_tag;
39
40 indexed_based_stl_iterator_base() noexcept = default;
41 indexed_based_stl_iterator_base(XprType& xpr, Index index) noexcept : mp_xpr(&xpr), m_index(index) {}
42
43 indexed_based_stl_iterator_base(const non_const_iterator& other) noexcept
44 : mp_xpr(other.mp_xpr), m_index(other.m_index) {}
45
46 indexed_based_stl_iterator_base& operator=(const non_const_iterator& other) {
47 mp_xpr = other.mp_xpr;
48 m_index = other.m_index;
49 return *this;
50 }
51
52 Derived& operator++() {
53 ++m_index;
54 return derived();
55 }
56 Derived& operator--() {
57 --m_index;
58 return derived();
59 }
60
61 Derived operator++(int) {
62 Derived prev(derived());
63 operator++();
64 return prev;
65 }
66 Derived operator--(int) {
67 Derived prev(derived());
68 operator--();
69 return prev;
70 }
71
72 friend Derived operator+(const indexed_based_stl_iterator_base& a, Index b) {
73 Derived ret(a.derived());
74 ret += b;
75 return ret;
76 }
77 friend Derived operator-(const indexed_based_stl_iterator_base& a, Index b) {
78 Derived ret(a.derived());
79 ret -= b;
80 return ret;
81 }
82 friend Derived operator+(Index a, const indexed_based_stl_iterator_base& b) {
83 Derived ret(b.derived());
84 ret += a;
85 return ret;
86 }
87 friend Derived operator-(Index a, const indexed_based_stl_iterator_base& b) {
88 Derived ret(b.derived());
89 ret -= a;
90 return ret;
91 }
92
93 Derived& operator+=(Index b) {
94 m_index += b;
95 return derived();
96 }
97 Derived& operator-=(Index b) {
98 m_index -= b;
99 return derived();
100 }
101
102 difference_type operator-(const indexed_based_stl_iterator_base& other) const {
103 eigen_assert(mp_xpr == other.mp_xpr);
104 return m_index - other.m_index;
105 }
106
107 difference_type operator-(const other_iterator& other) const {
108 eigen_assert(mp_xpr == other.mp_xpr);
109 return m_index - other.m_index;
110 }
111
112 bool operator==(const indexed_based_stl_iterator_base& other) const {
113 eigen_assert(mp_xpr == other.mp_xpr);
114 return m_index == other.m_index;
115 }
116 bool operator!=(const indexed_based_stl_iterator_base& other) const {
117 eigen_assert(mp_xpr == other.mp_xpr);
118 return m_index != other.m_index;
119 }
120 bool operator<(const indexed_based_stl_iterator_base& other) const {
121 eigen_assert(mp_xpr == other.mp_xpr);
122 return m_index < other.m_index;
123 }
124 bool operator<=(const indexed_based_stl_iterator_base& other) const {
125 eigen_assert(mp_xpr == other.mp_xpr);
126 return m_index <= other.m_index;
127 }
128 bool operator>(const indexed_based_stl_iterator_base& other) const {
129 eigen_assert(mp_xpr == other.mp_xpr);
130 return m_index > other.m_index;
131 }
132 bool operator>=(const indexed_based_stl_iterator_base& other) const {
133 eigen_assert(mp_xpr == other.mp_xpr);
134 return m_index >= other.m_index;
135 }
136
137 bool operator==(const other_iterator& other) const {
138 eigen_assert(mp_xpr == other.mp_xpr);
139 return m_index == other.m_index;
140 }
141 bool operator!=(const other_iterator& other) const {
142 eigen_assert(mp_xpr == other.mp_xpr);
143 return m_index != other.m_index;
144 }
145 bool operator<(const other_iterator& other) const {
146 eigen_assert(mp_xpr == other.mp_xpr);
147 return m_index < other.m_index;
148 }
149 bool operator<=(const other_iterator& other) const {
150 eigen_assert(mp_xpr == other.mp_xpr);
151 return m_index <= other.m_index;
152 }
153 bool operator>(const other_iterator& other) const {
154 eigen_assert(mp_xpr == other.mp_xpr);
155 return m_index > other.m_index;
156 }
157 bool operator>=(const other_iterator& other) const {
158 eigen_assert(mp_xpr == other.mp_xpr);
159 return m_index >= other.m_index;
160 }
161
162 protected:
163 Derived& derived() { return static_cast<Derived&>(*this); }
164 const Derived& derived() const { return static_cast<const Derived&>(*this); }
165
166 XprType* mp_xpr = nullptr;
167 Index m_index = 0;
168};
169
170template <typename Derived>
171class indexed_based_stl_reverse_iterator_base {
172 protected:
173 using traits = indexed_based_stl_iterator_traits<Derived>;
174 using XprType = typename traits::XprType;
175 using non_const_iterator = indexed_based_stl_reverse_iterator_base<typename traits::non_const_iterator>;
176 using const_iterator = indexed_based_stl_reverse_iterator_base<typename traits::const_iterator>;
177 using other_iterator = std::conditional_t<std::is_const<XprType>::value, non_const_iterator, const_iterator>;
178
179 friend class indexed_based_stl_reverse_iterator_base<typename traits::const_iterator>;
180 friend class indexed_based_stl_reverse_iterator_base<typename traits::non_const_iterator>;
181
182 public:
183 using difference_type = Index;
184 using iterator_category = std::random_access_iterator_tag;
185
186 indexed_based_stl_reverse_iterator_base() = default;
187 indexed_based_stl_reverse_iterator_base(XprType& xpr, Index index) : mp_xpr(&xpr), m_index(index) {}
188
189 indexed_based_stl_reverse_iterator_base(const non_const_iterator& other)
190 : mp_xpr(other.mp_xpr), m_index(other.m_index) {}
191
192 indexed_based_stl_reverse_iterator_base& operator=(const non_const_iterator& other) {
193 mp_xpr = other.mp_xpr;
194 m_index = other.m_index;
195 return *this;
196 }
197
198 Derived& operator++() {
199 --m_index;
200 return derived();
201 }
202 Derived& operator--() {
203 ++m_index;
204 return derived();
205 }
206
207 Derived operator++(int) {
208 Derived prev(derived());
209 operator++();
210 return prev;
211 }
212 Derived operator--(int) {
213 Derived prev(derived());
214 operator--();
215 return prev;
216 }
217
218 friend Derived operator+(const indexed_based_stl_reverse_iterator_base& a, Index b) {
219 Derived ret(a.derived());
220 ret += b;
221 return ret;
222 }
223 friend Derived operator-(const indexed_based_stl_reverse_iterator_base& a, Index b) {
224 Derived ret(a.derived());
225 ret -= b;
226 return ret;
227 }
228 friend Derived operator+(Index a, const indexed_based_stl_reverse_iterator_base& b) {
229 Derived ret(b.derived());
230 ret += a;
231 return ret;
232 }
233 friend Derived operator-(Index a, const indexed_based_stl_reverse_iterator_base& b) {
234 Derived ret(b.derived());
235 ret -= a;
236 return ret;
237 }
238
239 Derived& operator+=(Index b) {
240 m_index -= b;
241 return derived();
242 }
243 Derived& operator-=(Index b) {
244 m_index += b;
245 return derived();
246 }
247
248 difference_type operator-(const indexed_based_stl_reverse_iterator_base& other) const {
249 eigen_assert(mp_xpr == other.mp_xpr);
250 return other.m_index - m_index;
251 }
252
253 difference_type operator-(const other_iterator& other) const {
254 eigen_assert(mp_xpr == other.mp_xpr);
255 return other.m_index - m_index;
256 }
257
258 bool operator==(const indexed_based_stl_reverse_iterator_base& other) const {
259 eigen_assert(mp_xpr == other.mp_xpr);
260 return m_index == other.m_index;
261 }
262 bool operator!=(const indexed_based_stl_reverse_iterator_base& other) const {
263 eigen_assert(mp_xpr == other.mp_xpr);
264 return m_index != other.m_index;
265 }
266 bool operator<(const indexed_based_stl_reverse_iterator_base& other) const {
267 eigen_assert(mp_xpr == other.mp_xpr);
268 return m_index > other.m_index;
269 }
270 bool operator<=(const indexed_based_stl_reverse_iterator_base& other) const {
271 eigen_assert(mp_xpr == other.mp_xpr);
272 return m_index >= other.m_index;
273 }
274 bool operator>(const indexed_based_stl_reverse_iterator_base& other) const {
275 eigen_assert(mp_xpr == other.mp_xpr);
276 return m_index < other.m_index;
277 }
278 bool operator>=(const indexed_based_stl_reverse_iterator_base& other) const {
279 eigen_assert(mp_xpr == other.mp_xpr);
280 return m_index <= other.m_index;
281 }
282
283 bool operator==(const other_iterator& other) const {
284 eigen_assert(mp_xpr == other.mp_xpr);
285 return m_index == other.m_index;
286 }
287 bool operator!=(const other_iterator& other) const {
288 eigen_assert(mp_xpr == other.mp_xpr);
289 return m_index != other.m_index;
290 }
291 bool operator<(const other_iterator& other) const {
292 eigen_assert(mp_xpr == other.mp_xpr);
293 return m_index > other.m_index;
294 }
295 bool operator<=(const other_iterator& other) const {
296 eigen_assert(mp_xpr == other.mp_xpr);
297 return m_index >= other.m_index;
298 }
299 bool operator>(const other_iterator& other) const {
300 eigen_assert(mp_xpr == other.mp_xpr);
301 return m_index < other.m_index;
302 }
303 bool operator>=(const other_iterator& other) const {
304 eigen_assert(mp_xpr == other.mp_xpr);
305 return m_index <= other.m_index;
306 }
307
308 protected:
309 Derived& derived() { return static_cast<Derived&>(*this); }
310 const Derived& derived() const { return static_cast<const Derived&>(*this); }
311
312 XprType* mp_xpr = nullptr;
313 Index m_index = 0;
314};
315
316template <typename XprType>
317class pointer_based_stl_iterator {
318 static constexpr bool is_lvalue = internal::is_lvalue<XprType>::value;
319 static constexpr bool is_contiguous = XprType::InnerStrideAtCompileTime == 1;
320 using non_const_iterator = pointer_based_stl_iterator<std::remove_const_t<XprType>>;
321 using const_iterator = pointer_based_stl_iterator<std::add_const_t<XprType>>;
322 using other_iterator = std::conditional_t<std::is_const<XprType>::value, non_const_iterator, const_iterator>;
323
324 friend class pointer_based_stl_iterator<std::add_const_t<XprType>>;
325 friend class pointer_based_stl_iterator<std::remove_const_t<XprType>>;
326
327 public:
328 using difference_type = Index;
329 using value_type = typename XprType::Scalar;
330#if EIGEN_COMP_CXXVER >= 20 && defined(__cpp_lib_concepts) && __cpp_lib_concepts >= 202002L
331 using iterator_category =
332 std::conditional_t<is_contiguous, std::contiguous_iterator_tag, std::random_access_iterator_tag>;
333#else
334 using iterator_category = std::random_access_iterator_tag;
335#endif
336 using pointer = std::conditional_t<bool(is_lvalue), value_type*, const value_type*>;
337 using reference = std::conditional_t<bool(is_lvalue), value_type&, const value_type&>;
338
339 pointer_based_stl_iterator() noexcept = default;
340 pointer_based_stl_iterator(XprType& xpr, Index index) noexcept
341 : m_ptr(is_contiguous && index != 0 ? xpr.data() + index : xpr.data()),
342 m_index(is_contiguous ? 0 : index),
343 m_incr(xpr.innerStride()) {}
344
345 pointer_based_stl_iterator(const non_const_iterator& other) noexcept
346 : m_ptr(other.m_ptr), m_index(other.m_index), m_incr(other.m_incr) {}
347
348 pointer_based_stl_iterator& operator=(const non_const_iterator& other) noexcept {
349 m_ptr = other.m_ptr;
350 m_index = other.m_index;
351 m_incr.setValue(other.m_incr);
352 return *this;
353 }
354
355 reference operator*() const { return m_ptr[m_index.value() * m_incr.value()]; }
356 reference operator[](Index i) const { return m_ptr[(m_index.value() + i) * m_incr.value()]; }
357 pointer operator->() const { return m_index.value() == 0 ? m_ptr : m_ptr + m_index.value() * m_incr.value(); }
358
359 pointer_based_stl_iterator& operator++() { return *this += 1; }
360 pointer_based_stl_iterator& operator--() { return *this -= 1; }
361
362 pointer_based_stl_iterator operator++(int) {
363 pointer_based_stl_iterator prev(*this);
364 operator++();
365 return prev;
366 }
367 pointer_based_stl_iterator operator--(int) {
368 pointer_based_stl_iterator prev(*this);
369 operator--();
370 return prev;
371 }
372
373 friend pointer_based_stl_iterator operator+(const pointer_based_stl_iterator& a, Index b) {
374 pointer_based_stl_iterator ret(a);
375 ret += b;
376 return ret;
377 }
378 friend pointer_based_stl_iterator operator-(const pointer_based_stl_iterator& a, Index b) {
379 pointer_based_stl_iterator ret(a);
380 ret -= b;
381 return ret;
382 }
383 friend pointer_based_stl_iterator operator+(Index a, const pointer_based_stl_iterator& b) {
384 pointer_based_stl_iterator ret(b);
385 ret += a;
386 return ret;
387 }
388 friend pointer_based_stl_iterator operator-(Index a, const pointer_based_stl_iterator& b) {
389 pointer_based_stl_iterator ret(b);
390 ret -= a;
391 return ret;
392 }
393
394 pointer_based_stl_iterator& operator+=(Index b) {
395 EIGEN_IF_CONSTEXPR (is_contiguous) {
396 if (b != 0) m_ptr += b;
397 } else {
398 m_index.setValue(m_index.value() + b);
399 }
400 return *this;
401 }
402 pointer_based_stl_iterator& operator-=(Index b) {
403 EIGEN_IF_CONSTEXPR (is_contiguous) {
404 if (b != 0) m_ptr -= b;
405 } else {
406 m_index.setValue(m_index.value() - b);
407 }
408 return *this;
409 }
410
411 difference_type operator-(const pointer_based_stl_iterator& other) const {
412 EIGEN_IF_CONSTEXPR (is_contiguous) return m_ptr == other.m_ptr ? 0 : m_ptr - other.m_ptr;
413 eigen_assert(m_ptr == other.m_ptr);
414 return m_index.value() - other.m_index.value();
415 }
416
417 difference_type operator-(const other_iterator& other) const {
418 EIGEN_IF_CONSTEXPR (is_contiguous) return m_ptr == other.m_ptr ? 0 : m_ptr - other.m_ptr;
419 eigen_assert(m_ptr == other.m_ptr);
420 return m_index.value() - other.m_index.value();
421 }
422
423 bool operator==(const pointer_based_stl_iterator& other) const {
424 return m_ptr == other.m_ptr && m_index.value() == other.m_index.value();
425 }
426 bool operator!=(const pointer_based_stl_iterator& other) const { return !(*this == other); }
427 bool operator<(const pointer_based_stl_iterator& other) const {
428 EIGEN_IF_CONSTEXPR (is_contiguous) return m_ptr < other.m_ptr;
429 eigen_assert(m_ptr == other.m_ptr);
430 return m_index.value() < other.m_index.value();
431 }
432 bool operator<=(const pointer_based_stl_iterator& other) const { return !(other < *this); }
433 bool operator>(const pointer_based_stl_iterator& other) const { return other < *this; }
434 bool operator>=(const pointer_based_stl_iterator& other) const { return !(*this < other); }
435
436 bool operator==(const other_iterator& other) const {
437 return m_ptr == other.m_ptr && m_index.value() == other.m_index.value();
438 }
439 bool operator!=(const other_iterator& other) const { return !(*this == other); }
440 bool operator<(const other_iterator& other) const {
441 EIGEN_IF_CONSTEXPR (is_contiguous) return m_ptr < other.m_ptr;
442 eigen_assert(m_ptr == other.m_ptr);
443 return m_index.value() < other.m_index.value();
444 }
445 bool operator<=(const other_iterator& other) const { return !(other < *this); }
446 bool operator>(const other_iterator& other) const { return other < *this; }
447 bool operator>=(const other_iterator& other) const { return !(*this < other); }
448
449 protected:
450 // Only unit stride guarantees a valid end pointer. Otherwise keep the base pointer and a logical index.
451 pointer m_ptr = nullptr;
452 internal::variable_if_dynamic<Index, is_contiguous ? 0 : Dynamic> m_index{0};
453 internal::variable_if_dynamic<Index, XprType::InnerStrideAtCompileTime> m_incr{XprType::InnerStrideAtCompileTime};
454};
455
456template <typename XprType_>
457struct indexed_based_stl_iterator_traits<generic_randaccess_stl_iterator<XprType_>> {
458 using XprType = XprType_;
459 using non_const_iterator = generic_randaccess_stl_iterator<std::remove_const_t<XprType>>;
460 using const_iterator = generic_randaccess_stl_iterator<std::add_const_t<XprType>>;
461};
462
463template <typename XprType>
464class generic_randaccess_stl_iterator
465 : public indexed_based_stl_iterator_base<generic_randaccess_stl_iterator<XprType>> {
466 public:
467 using value_type = typename XprType::Scalar;
468
469 protected:
470 enum {
471 has_direct_access = (internal::traits<XprType>::Flags & DirectAccessBit) ? 1 : 0,
472 is_lvalue = internal::is_lvalue<XprType>::value
473 };
474
475 using Base = indexed_based_stl_iterator_base<generic_randaccess_stl_iterator>;
476 using Base::m_index;
477 using Base::mp_xpr;
478
479 // TODO: currently const Transpose/Reshape expressions never returns const references,
480 // so lets return by value too.
481 // typedef std::conditional_t<bool(has_direct_access), const value_type&, const value_type> read_only_ref_t;
482 using read_only_ref_t = const value_type;
483
484 public:
485 using pointer = std::conditional_t<bool(is_lvalue), value_type*, const value_type*>;
486 using reference = std::conditional_t<bool(is_lvalue), value_type&, read_only_ref_t>;
487
488 generic_randaccess_stl_iterator() = default;
489 generic_randaccess_stl_iterator(XprType& xpr, Index index) : Base(xpr, index) {}
490 generic_randaccess_stl_iterator(const typename Base::non_const_iterator& other) : Base(other) {}
491 using Base::operator=;
492
493 reference operator*() const { return (*mp_xpr)(m_index); }
494 reference operator[](Index i) const { return (*mp_xpr)(m_index + i); }
495 pointer operator->() const { return &((*mp_xpr)(m_index)); }
496};
497
498template <typename XprType_, DirectionType Direction>
499struct indexed_based_stl_iterator_traits<subvector_stl_iterator<XprType_, Direction>> {
500 using XprType = XprType_;
501 using non_const_iterator = subvector_stl_iterator<std::remove_const_t<XprType>, Direction>;
502 using const_iterator = subvector_stl_iterator<std::add_const_t<XprType>, Direction>;
503};
504
505template <typename XprType, DirectionType Direction>
506class subvector_stl_iterator : public indexed_based_stl_iterator_base<subvector_stl_iterator<XprType, Direction>> {
507 protected:
508 enum { is_lvalue = internal::is_lvalue<XprType>::value };
509
510 using Base = indexed_based_stl_iterator_base<subvector_stl_iterator>;
511 using Base::m_index;
512 using Base::mp_xpr;
513
514 using SubVectorType = std::conditional_t<Direction == Vertical, typename XprType::ColXpr, typename XprType::RowXpr>;
515 using ConstSubVectorType =
516 std::conditional_t<Direction == Vertical, typename XprType::ConstColXpr, typename XprType::ConstRowXpr>;
517
518 public:
519 using reference = std::conditional_t<bool(is_lvalue), SubVectorType, ConstSubVectorType>;
520 using value_type = typename reference::PlainObject;
521
522 private:
523 class subvector_stl_iterator_ptr {
524 public:
525 subvector_stl_iterator_ptr(const reference& subvector) : m_subvector(subvector) {}
526 reference* operator->() { return &m_subvector; }
527
528 private:
529 reference m_subvector;
530 };
531
532 public:
533 using pointer = subvector_stl_iterator_ptr;
534
535 subvector_stl_iterator() = default;
536 subvector_stl_iterator(XprType& xpr, Index index) : Base(xpr, index) {}
537 subvector_stl_iterator(const typename Base::non_const_iterator& other) : Base(other) {}
538
539 reference operator*() const { return (*mp_xpr).template subVector<Direction>(m_index); }
540 reference operator[](Index i) const { return (*mp_xpr).template subVector<Direction>(m_index + i); }
541 pointer operator->() const { return (*mp_xpr).template subVector<Direction>(m_index); }
542};
543
544template <typename XprType_, DirectionType Direction>
545struct indexed_based_stl_iterator_traits<subvector_stl_reverse_iterator<XprType_, Direction>> {
546 using XprType = XprType_;
547 using non_const_iterator = subvector_stl_reverse_iterator<std::remove_const_t<XprType>, Direction>;
548 using const_iterator = subvector_stl_reverse_iterator<std::add_const_t<XprType>, Direction>;
549};
550
551template <typename XprType, DirectionType Direction>
552class subvector_stl_reverse_iterator
553 : public indexed_based_stl_reverse_iterator_base<subvector_stl_reverse_iterator<XprType, Direction>> {
554 protected:
555 enum { is_lvalue = internal::is_lvalue<XprType>::value };
556
557 using Base = indexed_based_stl_reverse_iterator_base<subvector_stl_reverse_iterator>;
558 using Base::m_index;
559 using Base::mp_xpr;
560
561 using SubVectorType = std::conditional_t<Direction == Vertical, typename XprType::ColXpr, typename XprType::RowXpr>;
562 using ConstSubVectorType =
563 std::conditional_t<Direction == Vertical, typename XprType::ConstColXpr, typename XprType::ConstRowXpr>;
564
565 public:
566 using reference = std::conditional_t<bool(is_lvalue), SubVectorType, ConstSubVectorType>;
567 using value_type = typename reference::PlainObject;
568
569 private:
570 class subvector_stl_reverse_iterator_ptr {
571 public:
572 subvector_stl_reverse_iterator_ptr(const reference& subvector) : m_subvector(subvector) {}
573 reference* operator->() { return &m_subvector; }
574
575 private:
576 reference m_subvector;
577 };
578
579 public:
580 using pointer = subvector_stl_reverse_iterator_ptr;
581
582 subvector_stl_reverse_iterator() = default;
583 subvector_stl_reverse_iterator(XprType& xpr, Index index) : Base(xpr, index) {}
584 subvector_stl_reverse_iterator(const typename Base::non_const_iterator& other) : Base(other) {}
586 reference operator*() const { return (*mp_xpr).template subVector<Direction>(m_index); }
587 reference operator[](Index i) const { return (*mp_xpr).template subVector<Direction>(m_index - i); }
588 pointer operator->() const { return (*mp_xpr).template subVector<Direction>(m_index); }
590
591} // namespace internal
592
597template <typename Derived>
599 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
600 return iterator(derived(), 0);
601}
602
604template <typename Derived>
606 return cbegin();
607}
608
613template <typename Derived>
615 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
616 return const_iterator(derived(), 0);
617}
618
623template <typename Derived>
625 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
626 return iterator(derived(), size());
627}
628
630template <typename Derived>
632 return cend();
633}
634
639template <typename Derived>
641 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
642 return const_iterator(derived(), size());
643}
644
645} // namespace Eigen
646
647#endif // EIGEN_STLITERATORS_H
iterator begin()
Definition StlIterators.h:598
random_access_iterator_type const_iterator
Definition DenseBase.h:567
constexpr std::conditional_t< Direction==Vertical, ColXpr, RowXpr > subVector(Index i)
Definition DenseBase.h:1364
iterator end()
Definition StlIterators.h:624
const_iterator cbegin() const
Definition StlIterators.h:614
const_iterator cend() const
Definition StlIterators.h:640
random_access_iterator_type iterator
Definition DenseBase.h:565
constexpr unsigned int DirectAccessBit
Definition Constants.h:160