ONE - On-device Neural Engine
Loading...
Searching...
No Matches
nnfw::cker::ShapeIterator Struct Reference

#include <ShapeIterator.h>

Public Types

using value_type = decltype(std::declval< Shape >().Dims(0))
 Definition of this iterator's traits that can be accessed by std::iterator_traits<It>
 
using difference_type = std::ptrdiff_t
 
using pointer = value_type *
 
using reference = value_type &
 
using iterator_category = std::bidirectional_iterator_tag
 

Public Member Functions

 ShapeIterator (const Shape &s)
 
ShapeIteratoroperator++ ()
 
ShapeIterator operator++ (int)
 
ShapeIteratoroperator-- ()
 
ShapeIterator operator-- (int)
 
bool operator!= (const ShapeIterator &other) const
 
bool operator== (const ShapeIterator &other) const
 
value_type operator* () const
 

Static Public Member Functions

static ShapeIterator end_iterator (const Shape &s)
 

Detailed Description

Definition at line 27 of file ShapeIterator.h.

Member Typedef Documentation

◆ difference_type

Definition at line 31 of file ShapeIterator.h.

◆ iterator_category

using nnfw::cker::ShapeIterator::iterator_category = std::bidirectional_iterator_tag

Definition at line 34 of file ShapeIterator.h.

◆ pointer

Definition at line 32 of file ShapeIterator.h.

◆ reference

Definition at line 33 of file ShapeIterator.h.

◆ value_type

using nnfw::cker::ShapeIterator::value_type = decltype(std::declval<Shape>().Dims(0))

Definition of this iterator's traits that can be accessed by std::iterator_traits<It>

Definition at line 30 of file ShapeIterator.h.

Constructor & Destructor Documentation

◆ ShapeIterator()

nnfw::cker::ShapeIterator::ShapeIterator ( const Shape s)
inline

Definition at line 36 of file ShapeIterator.h.

36: _shape{s}, _current{0}, _last{s.DimensionsCount()} {}

Member Function Documentation

◆ end_iterator()

static ShapeIterator nnfw::cker::ShapeIterator::end_iterator ( const Shape s)
inlinestatic

Definition at line 37 of file ShapeIterator.h.

37{ return ShapeIterator(s, EndIteratorTag{}); }
ShapeIterator(const Shape &s)

Referenced by nnfw::cker::end().

◆ operator!=()

bool nnfw::cker::ShapeIterator::operator!= ( const ShapeIterator other) const
inline

Definition at line 66 of file ShapeIterator.h.

66{ return _current != other._current; }

◆ operator*()

value_type nnfw::cker::ShapeIterator::operator* ( ) const
inline

Because the underlying method returns by-value, this operator does the same instead of returning by-reference like most iterators do.

Definition at line 71 of file ShapeIterator.h.

71{ return _shape.Dims(_current); }
int32_t Dims(int i) const
Definition Shape.h:92

References nnfw::cker::Shape::Dims().

◆ operator++() [1/2]

ShapeIterator & nnfw::cker::ShapeIterator::operator++ ( )
inline

Definition at line 39 of file ShapeIterator.h.

40 {
41 ++_current;
42 return *this;
43 }

◆ operator++() [2/2]

ShapeIterator nnfw::cker::ShapeIterator::operator++ ( int  )
inline

Definition at line 46 of file ShapeIterator.h.

47 {
48 auto copy = *this;
49 ++_current;
50 return copy;
51 }

◆ operator--() [1/2]

ShapeIterator & nnfw::cker::ShapeIterator::operator-- ( )
inline

Definition at line 53 of file ShapeIterator.h.

54 {
55 --_current;
56 return *this;
57 }

◆ operator--() [2/2]

ShapeIterator nnfw::cker::ShapeIterator::operator-- ( int  )
inline

Definition at line 59 of file ShapeIterator.h.

60 {
61 auto copy = *this;
62 --_current;
63 return copy;
64 }

◆ operator==()

bool nnfw::cker::ShapeIterator::operator== ( const ShapeIterator other) const
inline

Definition at line 67 of file ShapeIterator.h.

67{ return _current == other._current; }

The documentation for this struct was generated from the following file: