Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
SkEnumerate< Iter, C > Class Template Reference

#include <SkEnumerate.h>

Public Member Functions

constexpr SkEnumerate (Iter begin, Iter end)
 
constexpr SkEnumerate (C &&c)
 
constexpr SkEnumerate (const SkEnumerate &that)=default
 
constexpr SkEnumerateoperator= (const SkEnumerate &that)
 
constexpr Iterator begin () const
 
constexpr Iterator end () const
 
constexpr bool empty () const
 
constexpr size_t size () const
 
constexpr ptrdiff_t ssize () const
 
constexpr SkEnumerate first (size_t n)
 
constexpr SkEnumerate last (size_t n)
 
constexpr SkEnumerate subspan (size_t offset, size_t count)
 

Detailed Description

template<typename Iter, typename C = std::monostate>
class SkEnumerate< Iter, C >

Definition at line 17 of file SkEnumerate.h.

Constructor & Destructor Documentation

◆ SkEnumerate() [1/3]

template<typename Iter , typename C = std::monostate>
constexpr SkEnumerate< Iter, C >::SkEnumerate ( Iter  begin,
Iter  end 
)
inlineconstexpr

Definition at line 55 of file SkEnumerate.h.

55: SkEnumerate{0, begin, end} {}
constexpr Iterator begin() const
Definition: SkEnumerate.h:67
constexpr Iterator end() const
Definition: SkEnumerate.h:68

◆ SkEnumerate() [2/3]

template<typename Iter , typename C = std::monostate>
constexpr SkEnumerate< Iter, C >::SkEnumerate ( C &&  c)
inlineexplicitconstexpr

Definition at line 56 of file SkEnumerate.h.

57 : fCollection{std::move(c)}
58 , fBeginIndex{0}
59 , fBegin{std::begin(fCollection)}
60 , fEnd{std::end(fCollection)} { }
static const char * begin(const StringSlice &s)
Definition: editor.cpp:252

◆ SkEnumerate() [3/3]

template<typename Iter , typename C = std::monostate>
constexpr SkEnumerate< Iter, C >::SkEnumerate ( const SkEnumerate< Iter, C > &  that)
constexprdefault

Member Function Documentation

◆ begin()

template<typename Iter , typename C = std::monostate>
constexpr Iterator SkEnumerate< Iter, C >::begin ( ) const
inlineconstexpr

Definition at line 67 of file SkEnumerate.h.

67{ return Iterator{fBeginIndex, fBegin}; }

◆ empty()

template<typename Iter , typename C = std::monostate>
constexpr bool SkEnumerate< Iter, C >::empty ( ) const
inlineconstexpr

Definition at line 69 of file SkEnumerate.h.

69{ return fBegin == fEnd; }

◆ end()

template<typename Iter , typename C = std::monostate>
constexpr Iterator SkEnumerate< Iter, C >::end ( ) const
inlineconstexpr

Definition at line 68 of file SkEnumerate.h.

68{ return Iterator{fBeginIndex + this->ssize(), fEnd}; }
constexpr ptrdiff_t ssize() const
Definition: SkEnumerate.h:71

◆ first()

template<typename Iter , typename C = std::monostate>
constexpr SkEnumerate SkEnumerate< Iter, C >::first ( size_t  n)
inlineconstexpr

Definition at line 72 of file SkEnumerate.h.

72 {
73 SkASSERT(n <= this->size());
74 ptrdiff_t deltaEnd = this->ssize() - n;
75 return SkEnumerate{fBeginIndex, fBegin, std::prev(fEnd, deltaEnd)};
76 }
static float prev(float f)
#define SkASSERT(cond)
Definition: SkAssert.h:116
constexpr size_t size() const
Definition: SkEnumerate.h:70

◆ last()

template<typename Iter , typename C = std::monostate>
constexpr SkEnumerate SkEnumerate< Iter, C >::last ( size_t  n)
inlineconstexpr

Definition at line 77 of file SkEnumerate.h.

77 {
78 SkASSERT(n <= this->size());
79 ptrdiff_t deltaBegin = this->ssize() - n;
80 return SkEnumerate{fBeginIndex + deltaBegin, std::next(fBegin, deltaBegin), fEnd};
81 }
static float next(float f)

◆ operator=()

template<typename Iter , typename C = std::monostate>
constexpr SkEnumerate & SkEnumerate< Iter, C >::operator= ( const SkEnumerate< Iter, C > &  that)
inlineconstexpr

Definition at line 62 of file SkEnumerate.h.

62 {
63 fBegin = that.fBegin;
64 fEnd = that.fEnd;
65 return *this;
66 }

◆ size()

template<typename Iter , typename C = std::monostate>
constexpr size_t SkEnumerate< Iter, C >::size ( ) const
inlineconstexpr

Definition at line 70 of file SkEnumerate.h.

70{ return std::distance(fBegin, fEnd); }

◆ ssize()

template<typename Iter , typename C = std::monostate>
constexpr ptrdiff_t SkEnumerate< Iter, C >::ssize ( ) const
inlineconstexpr

Definition at line 71 of file SkEnumerate.h.

71{ return std::distance(fBegin, fEnd); }

◆ subspan()

template<typename Iter , typename C = std::monostate>
constexpr SkEnumerate SkEnumerate< Iter, C >::subspan ( size_t  offset,
size_t  count 
)
inlineconstexpr

Definition at line 82 of file SkEnumerate.h.

82 {
83 SkASSERT(offset < this->size());
84 SkASSERT(count <= this->size() - offset);
85 auto newBegin = std::next(fBegin, offset);
86 return SkEnumerate(fBeginIndex + offset, newBegin, std::next(newBegin, count));
87 }
int count
Definition: FontMgrTest.cpp:50
constexpr SkEnumerate(Iter begin, Iter end)
Definition: SkEnumerate.h:55
SeparatedVector2 offset

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