LLVM  8.0.1
Public Member Functions | Static Public Member Functions | List of all members
llvm::ArrayRecycler< T, Align >::Capacity Class Reference

The size of an allocated array is represented by a Capacity instance. More...

#include "llvm/Support/ArrayRecycler.h"

Public Member Functions

 Capacity ()
 
size_t getSize () const
 Get the number of elements in an array with this capacity. More...
 
unsigned getBucket () const
 Get the bucket number for this capacity. More...
 
Capacity getNext () const
 Get the next larger capacity. More...
 

Static Public Member Functions

static Capacity get (size_t N)
 Get the capacity of an array that can hold at least N elements. More...
 

Detailed Description

template<class T, size_t Align = alignof(T)>
class llvm::ArrayRecycler< T, Align >::Capacity

The size of an allocated array is represented by a Capacity instance.

This class is much smaller than a size_t, and it provides methods to work with the set of legal array capacities.

Definition at line 72 of file ArrayRecycler.h.

Constructor & Destructor Documentation

◆ Capacity()

template<class T, size_t Align = alignof(T)>
llvm::ArrayRecycler< T, Align >::Capacity::Capacity ( )
inline

Definition at line 77 of file ArrayRecycler.h.

Member Function Documentation

◆ get()

template<class T, size_t Align = alignof(T)>
static Capacity llvm::ArrayRecycler< T, Align >::Capacity::get ( size_t  N)
inlinestatic

Get the capacity of an array that can hold at least N elements.

Definition at line 80 of file ArrayRecycler.h.

References llvm::Log2_64_Ceil(), and N.

◆ getBucket()

template<class T, size_t Align = alignof(T)>
unsigned llvm::ArrayRecycler< T, Align >::Capacity::getBucket ( ) const
inline

Get the bucket number for this capacity.

Definition at line 88 of file ArrayRecycler.h.

◆ getNext()

template<class T, size_t Align = alignof(T)>
Capacity llvm::ArrayRecycler< T, Align >::Capacity::getNext ( ) const
inline

Get the next larger capacity.

Large capacities grow exponentially, so this function can be used to reallocate incrementally growing vectors in amortized linear time.

Definition at line 93 of file ArrayRecycler.h.

◆ getSize()

template<class T, size_t Align = alignof(T)>
size_t llvm::ArrayRecycler< T, Align >::Capacity::getSize ( ) const
inline

Get the number of elements in an array with this capacity.

Definition at line 85 of file ArrayRecycler.h.


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