LLVM  14.0.0git
Public Member Functions | Static Public Member Functions | List of all members
llvm::indexed_accessor_range< DerivedT, BaseT, T, PointerT, ReferenceT > Class Template Reference

This class provides an implementation of a range of indexed_accessor_iterators where the base is not indexable. More...

#include "llvm/ADT/STLExtras.h"

Inheritance diagram for llvm::indexed_accessor_range< DerivedT, BaseT, T, PointerT, ReferenceT >:
Inheritance graph
[legend]
Collaboration diagram for llvm::indexed_accessor_range< DerivedT, BaseT, T, PointerT, ReferenceT >:
Collaboration graph
[legend]

Public Member Functions

 indexed_accessor_range (BaseT base, ptrdiff_t startIndex, ptrdiff_t count)
 
const BaseT & getBase () const
 Returns the current base of the range. More...
 
ptrdiff_t getStartIndex () const
 Returns the current start index of the range. More...
 
- Public Member Functions inherited from llvm::detail::indexed_accessor_range_base< DerivedT, std::pair< BaseT, ptrdiff_t >, T, T *, T & >
 indexed_accessor_range_base (iterator begin, iterator end)
 
 indexed_accessor_range_base (const iterator_range< iterator > &range)
 
 indexed_accessor_range_base (std::pair< BaseT, ptrdiff_t > base, ptrdiff_t count)
 
iterator begin () const
 
iterator end () const
 
Toperator[] (size_t Index) const
 
Tfront () const
 
Tback () const
 
bool operator== (const OtherT &other) const
 Compare this range with another. More...
 
bool operator!= (const OtherT &other) const
 
size_t size () const
 Return the size of this range. More...
 
bool empty () const
 Return if the range is empty. More...
 
DerivedT slice (size_t n, size_t m) const
 Drop the first N elements, and keep M elements. More...
 
DerivedT drop_front (size_t n=1) const
 Drop the first n elements. More...
 
DerivedT drop_back (size_t n=1) const
 Drop the last n elements. More...
 
DerivedT take_front (size_t n=1) const
 Take the first n elements. More...
 
DerivedT take_back (size_t n=1) const
 Take the last n elements. More...
 
 operator RangeT () const
 Allow conversion to any type accepting an iterator_range. More...
 
const std::pair< BaseT, ptrdiff_t > & getBase () const
 Returns the base of this range. More...
 

Static Public Member Functions

static std::pair< BaseT, ptrdiff_toffset_base (const std::pair< BaseT, ptrdiff_t > &base, ptrdiff_t index)
 See detail::indexed_accessor_range_base for details. More...
 
static ReferenceT dereference_iterator (const std::pair< BaseT, ptrdiff_t > &base, ptrdiff_t index)
 See detail::indexed_accessor_range_base for details. More...
 

Additional Inherited Members

- Public Types inherited from llvm::detail::indexed_accessor_range_base< DerivedT, std::pair< BaseT, ptrdiff_t >, T, T *, T & >
using RangeBaseT = indexed_accessor_range_base
 
- Protected Member Functions inherited from llvm::detail::indexed_accessor_range_base< DerivedT, std::pair< BaseT, ptrdiff_t >, T, T *, T & >
 indexed_accessor_range_base (const indexed_accessor_range_base &)=default
 
 indexed_accessor_range_base (indexed_accessor_range_base &&)=default
 
indexed_accessor_range_baseoperator= (const indexed_accessor_range_base &)=default
 
- Protected Attributes inherited from llvm::detail::indexed_accessor_range_base< DerivedT, std::pair< BaseT, ptrdiff_t >, T, T *, T & >
std::pair< BaseT, ptrdiff_tbase
 The base that owns the provided range of values. More...
 
ptrdiff_t count
 The size from the owning range. More...
 

Detailed Description

template<typename DerivedT, typename BaseT, typename T, typename PointerT = T *, typename ReferenceT = T &>
class llvm::indexed_accessor_range< DerivedT, BaseT, T, PointerT, ReferenceT >

This class provides an implementation of a range of indexed_accessor_iterators where the base is not indexable.

Ranges with bases that are offsetable should derive from indexed_accessor_range_base instead. Derived range classes are expected to implement the following static method:

Definition at line 1251 of file STLExtras.h.

Constructor & Destructor Documentation

◆ indexed_accessor_range()

template<typename DerivedT , typename BaseT , typename T , typename PointerT = T *, typename ReferenceT = T &>
llvm::indexed_accessor_range< DerivedT, BaseT, T, PointerT, ReferenceT >::indexed_accessor_range ( BaseT  base,
ptrdiff_t  startIndex,
ptrdiff_t  count 
)
inline

Definition at line 1255 of file STLExtras.h.

References T.

Member Function Documentation

◆ dereference_iterator()

template<typename DerivedT , typename BaseT , typename T , typename PointerT = T *, typename ReferenceT = T &>
static ReferenceT llvm::indexed_accessor_range< DerivedT, BaseT, T, PointerT, ReferenceT >::dereference_iterator ( const std::pair< BaseT, ptrdiff_t > &  base,
ptrdiff_t  index 
)
inlinestatic

◆ getBase()

template<typename DerivedT , typename BaseT , typename T , typename PointerT = T *, typename ReferenceT = T &>
const BaseT& llvm::indexed_accessor_range< DerivedT, BaseT, T, PointerT, ReferenceT >::getBase ( ) const
inline

Returns the current base of the range.

Definition at line 1264 of file STLExtras.h.

References llvm::detail::indexed_accessor_range_base< DerivedT, std::pair< BaseT, ptrdiff_t >, T, T *, T & >::base.

◆ getStartIndex()

template<typename DerivedT , typename BaseT , typename T , typename PointerT = T *, typename ReferenceT = T &>
ptrdiff_t llvm::indexed_accessor_range< DerivedT, BaseT, T, PointerT, ReferenceT >::getStartIndex ( ) const
inline

Returns the current start index of the range.

Definition at line 1267 of file STLExtras.h.

References llvm::detail::indexed_accessor_range_base< DerivedT, std::pair< BaseT, ptrdiff_t >, T, T *, T & >::base.

◆ offset_base()

template<typename DerivedT , typename BaseT , typename T , typename PointerT = T *, typename ReferenceT = T &>
static std::pair<BaseT, ptrdiff_t> llvm::indexed_accessor_range< DerivedT, BaseT, T, PointerT, ReferenceT >::offset_base ( const std::pair< BaseT, ptrdiff_t > &  base,
ptrdiff_t  index 
)
inlinestatic

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