LLVM 23.0.0git
llvm::Repeated< T > Struct Template Reference

A memory-efficient immutable range with a single value repeated N times. More...

#include "llvm/ADT/Repeated.h"

Classes

struct  Storage
 Wrapper for the stored value used as a PointerUnion target in range types (e.g., TypeRange, ValueRange). More...

Public Types

using iterator = RepeatedIterator<T>
using const_iterator = iterator
using reverse_iterator = std::reverse_iterator<iterator>
using const_reverse_iterator = reverse_iterator
using value_type = T
using size_type = size_t

Public Member Functions

template<typename U>
 Repeated (size_t count, U &&value)
 Create a value repeated count times.
iterator begin () const
iterator end () const
reverse_iterator rbegin () const
reverse_iterator rend () const
size_t size () const
bool empty () const
const Tvalue () const
const Toperator[] (size_t idx) const

Public Attributes

Storage storage
size_t count

Detailed Description

template<typename T>
struct llvm::Repeated< T >

A memory-efficient immutable range with a single value repeated N times.

The value is owned by the range.

Repeated<T> is also a proper random-access range: begin()/end() return iterators that always dereference to the same stored value.

Definition at line 75 of file Repeated.h.

Member Typedef Documentation

◆ const_iterator

template<typename T>
using llvm::Repeated< T >::const_iterator = iterator

Definition at line 92 of file Repeated.h.

◆ const_reverse_iterator

template<typename T>
using llvm::Repeated< T >::const_reverse_iterator = reverse_iterator

Definition at line 94 of file Repeated.h.

◆ iterator

template<typename T>
using llvm::Repeated< T >::iterator = RepeatedIterator<T>

Definition at line 91 of file Repeated.h.

◆ reverse_iterator

template<typename T>
using llvm::Repeated< T >::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 93 of file Repeated.h.

◆ size_type

template<typename T>
using llvm::Repeated< T >::size_type = size_t

Definition at line 96 of file Repeated.h.

◆ value_type

template<typename T>
using llvm::Repeated< T >::value_type = T

Definition at line 95 of file Repeated.h.

Constructor & Destructor Documentation

◆ Repeated()

template<typename T>
template<typename U>
llvm::Repeated< T >::Repeated ( size_t count,
U && value )
inline

Create a value repeated count times.

Uses the same argument order like STD container constructors.

Definition at line 88 of file Repeated.h.

References count, storage, and value().

Member Function Documentation

◆ begin()

template<typename T>
iterator llvm::Repeated< T >::begin ( ) const
inline

Definition at line 98 of file Repeated.h.

References storage.

Referenced by rend().

◆ empty()

template<typename T>
bool llvm::Repeated< T >::empty ( ) const
inline

Definition at line 106 of file Repeated.h.

References count.

◆ end()

template<typename T>
iterator llvm::Repeated< T >::end ( ) const
inline

Definition at line 99 of file Repeated.h.

References count, and storage.

Referenced by rbegin().

◆ operator[]()

template<typename T>
const T & llvm::Repeated< T >::operator[] ( size_t idx) const
inline

Definition at line 109 of file Repeated.h.

References assert(), size(), storage, and T.

◆ rbegin()

template<typename T>
reverse_iterator llvm::Repeated< T >::rbegin ( ) const
inline

Definition at line 102 of file Repeated.h.

References end().

◆ rend()

template<typename T>
reverse_iterator llvm::Repeated< T >::rend ( ) const
inline

Definition at line 103 of file Repeated.h.

References begin().

◆ size()

template<typename T>
size_t llvm::Repeated< T >::size ( ) const
inline

Definition at line 105 of file Repeated.h.

References count.

Referenced by operator[]().

◆ value()

template<typename T>
const T & llvm::Repeated< T >::value ( ) const
inline

Definition at line 108 of file Repeated.h.

References storage, and T.

Referenced by Repeated().

Member Data Documentation

◆ count

template<typename T>
size_t llvm::Repeated< T >::count

Definition at line 83 of file Repeated.h.

Referenced by empty(), end(), Repeated(), and size().

◆ storage

template<typename T>
Storage llvm::Repeated< T >::storage

Definition at line 82 of file Repeated.h.

Referenced by begin(), end(), operator[](), Repeated(), and value().


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