RAJA
RAJA provides a collection of platform portability abstractions for C++ HPC applications.
Public Types | Public Member Functions | List of all members
RAJA::RAJAVec< T, Allocator > Class Template Reference

Class template that provides a simple vector implementation sufficient to insulate RAJA entities from the STL. More...

#include <RAJAVec.hpp>

Public Types

using value_type = T
 
using allocator_type = Allocator
 
using size_type = std::size_t
 
using difference_type = std::ptrdiff_t
 
using reference = value_type &
 
using const_reference = const value_type &
 
using pointer = typename allocator_traits_type::pointer
 
using const_pointer = typename allocator_traits_type::const_pointer
 
using iterator = value_type *
 
using const_iterator = const value_type *
 

Public Member Functions

 RAJAVec (size_type init_cap=0, const allocator_type &a=allocator_type())
 
 RAJAVec (const RAJAVec &other)
 
 RAJAVec (RAJAVec &&other)
 
RAJAVecoperator= (const RAJAVec &rhs)
 
RAJAVecoperator= (RAJAVec &&rhs)
 
 ~RAJAVec ()
 
void swap (RAJAVec &other)
 
pointer data ()
 
const_pointer data () const
 
iterator end ()
 
const_iterator end () const
 
const_iterator cend () const
 
iterator begin ()
 
const_iterator begin () const
 
const_iterator cbegin () const
 
bool empty () const
 
size_type size () const
 
size_type capacity () const
 
allocator_type get_allocator () const
 
void reserve (size_type target_capacity)
 
void shrink_to_fit ()
 
void clear ()
 
RAJA_INLINE void resize (size_type new_size)
 
RAJA_INLINE void resize (size_type new_size, const_reference new_value)
 
reference operator[] (difference_type i)
 
const_reference operator[] (difference_type i) const
 
reference front ()
 
const_reference front () const
 
reference back ()
 
const_reference back () const
 
void push_front (const_reference item)
 
void push_front (value_type &&item)
 
template<typename... Os>
void emplace_front (Os &&... os)
 
void push_back (const_reference item)
 
void push_back (value_type &&item)
 
template<typename... Os>
void emplace_back (Os &&... os)
 
void pop_back ()
 

Detailed Description

template<typename T, typename Allocator = std::allocator<T>>
class RAJA::RAJAVec< T, Allocator >

Class template that provides a simple vector implementation sufficient to insulate RAJA entities from the STL.

Note: This class has limited functionality sufficient to support its usage for RAJA TypedIndexSet operations. However, it does provide a push_front method that is not found in the STL vector container.

Template type should support standard semantics for copy, swap, etc.

Note that this class has no exception safety guarantees.

Member Typedef Documentation

◆ value_type

template<typename T , typename Allocator = std::allocator<T>>
using RAJA::RAJAVec< T, Allocator >::value_type = T

◆ allocator_type

template<typename T , typename Allocator = std::allocator<T>>
using RAJA::RAJAVec< T, Allocator >::allocator_type = Allocator

◆ size_type

template<typename T , typename Allocator = std::allocator<T>>
using RAJA::RAJAVec< T, Allocator >::size_type = std::size_t

◆ difference_type

template<typename T , typename Allocator = std::allocator<T>>
using RAJA::RAJAVec< T, Allocator >::difference_type = std::ptrdiff_t

◆ reference

template<typename T , typename Allocator = std::allocator<T>>
using RAJA::RAJAVec< T, Allocator >::reference = value_type&

◆ const_reference

template<typename T , typename Allocator = std::allocator<T>>
using RAJA::RAJAVec< T, Allocator >::const_reference = const value_type&

◆ pointer

template<typename T , typename Allocator = std::allocator<T>>
using RAJA::RAJAVec< T, Allocator >::pointer = typename allocator_traits_type::pointer

◆ const_pointer

template<typename T , typename Allocator = std::allocator<T>>
using RAJA::RAJAVec< T, Allocator >::const_pointer = typename allocator_traits_type::const_pointer

◆ iterator

template<typename T , typename Allocator = std::allocator<T>>
using RAJA::RAJAVec< T, Allocator >::iterator = value_type*

◆ const_iterator

template<typename T , typename Allocator = std::allocator<T>>
using RAJA::RAJAVec< T, Allocator >::const_iterator = const value_type*

Constructor & Destructor Documentation

◆ RAJAVec() [1/3]

template<typename T , typename Allocator = std::allocator<T>>
RAJA::RAJAVec< T, Allocator >::RAJAVec ( size_type  init_cap = 0,
const allocator_type a = allocator_type() 
)
inlineexplicit

Construct empty vector with given capacity.

◆ RAJAVec() [2/3]

template<typename T , typename Allocator = std::allocator<T>>
RAJA::RAJAVec< T, Allocator >::RAJAVec ( const RAJAVec< T, Allocator > &  other)
inline

Copy ctor for vector.

◆ RAJAVec() [3/3]

template<typename T , typename Allocator = std::allocator<T>>
RAJA::RAJAVec< T, Allocator >::RAJAVec ( RAJAVec< T, Allocator > &&  other)
inline

Move ctor for vector.

◆ ~RAJAVec()

template<typename T , typename Allocator = std::allocator<T>>
RAJA::RAJAVec< T, Allocator >::~RAJAVec ( )
inline

Destroy vector and its data.

Member Function Documentation

◆ operator=() [1/2]

template<typename T , typename Allocator = std::allocator<T>>
RAJAVec& RAJA::RAJAVec< T, Allocator >::operator= ( const RAJAVec< T, Allocator > &  rhs)
inline

Copy-assignment operator for vector.

◆ operator=() [2/2]

template<typename T , typename Allocator = std::allocator<T>>
RAJAVec& RAJA::RAJAVec< T, Allocator >::operator= ( RAJAVec< T, Allocator > &&  rhs)
inline

Move-assignment operator for vector.

◆ swap()

template<typename T , typename Allocator = std::allocator<T>>
void RAJA::RAJAVec< T, Allocator >::swap ( RAJAVec< T, Allocator > &  other)
inline

Swap function for copy-and-swap idiom.

◆ data() [1/2]

template<typename T , typename Allocator = std::allocator<T>>
pointer RAJA::RAJAVec< T, Allocator >::data ( )
inline

Get a pointer to the beginning of the contiguous vector

◆ data() [2/2]

template<typename T , typename Allocator = std::allocator<T>>
const_pointer RAJA::RAJAVec< T, Allocator >::data ( ) const
inline

◆ end() [1/2]

template<typename T , typename Allocator = std::allocator<T>>
iterator RAJA::RAJAVec< T, Allocator >::end ( )
inline

Get an iterator to the end.

◆ end() [2/2]

template<typename T , typename Allocator = std::allocator<T>>
const_iterator RAJA::RAJAVec< T, Allocator >::end ( ) const
inline

◆ cend()

template<typename T , typename Allocator = std::allocator<T>>
const_iterator RAJA::RAJAVec< T, Allocator >::cend ( ) const
inline

◆ begin() [1/2]

template<typename T , typename Allocator = std::allocator<T>>
iterator RAJA::RAJAVec< T, Allocator >::begin ( )
inline

Get an iterator to the beginning.

◆ begin() [2/2]

template<typename T , typename Allocator = std::allocator<T>>
const_iterator RAJA::RAJAVec< T, Allocator >::begin ( ) const
inline

◆ cbegin()

template<typename T , typename Allocator = std::allocator<T>>
const_iterator RAJA::RAJAVec< T, Allocator >::cbegin ( ) const
inline

◆ empty()

template<typename T , typename Allocator = std::allocator<T>>
bool RAJA::RAJAVec< T, Allocator >::empty ( ) const
inline

Return true if vector has size zero; false otherwise.

◆ size()

template<typename T , typename Allocator = std::allocator<T>>
size_type RAJA::RAJAVec< T, Allocator >::size ( ) const
inline

Return current size of vector.

◆ capacity()

template<typename T , typename Allocator = std::allocator<T>>
size_type RAJA::RAJAVec< T, Allocator >::capacity ( ) const
inline

Return current capacity of vector.

◆ get_allocator()

template<typename T , typename Allocator = std::allocator<T>>
allocator_type RAJA::RAJAVec< T, Allocator >::get_allocator ( ) const
inline

Get the allocator used by the container.

◆ reserve()

template<typename T , typename Allocator = std::allocator<T>>
void RAJA::RAJAVec< T, Allocator >::reserve ( size_type  target_capacity)
inline

Grow the capacity of the vector.

◆ shrink_to_fit()

template<typename T , typename Allocator = std::allocator<T>>
void RAJA::RAJAVec< T, Allocator >::shrink_to_fit ( )
inline

Shrink the capacity of the vector to the current size.

◆ clear()

template<typename T , typename Allocator = std::allocator<T>>
void RAJA::RAJAVec< T, Allocator >::clear ( )
inline

Empty vector of all data.

◆ resize() [1/2]

template<typename T , typename Allocator = std::allocator<T>>
RAJA_INLINE void RAJA::RAJAVec< T, Allocator >::resize ( size_type  new_size)
inline

Change the size of the vector, default initializing any new items, destroying any extra items.

◆ resize() [2/2]

template<typename T , typename Allocator = std::allocator<T>>
RAJA_INLINE void RAJA::RAJAVec< T, Allocator >::resize ( size_type  new_size,
const_reference  new_value 
)
inline

Change the size of the vector, initializing any new items with new_value, destroying any extra items.

◆ operator[]() [1/2]

template<typename T , typename Allocator = std::allocator<T>>
reference RAJA::RAJAVec< T, Allocator >::operator[] ( difference_type  i)
inline

Bracket operator accessor.

◆ operator[]() [2/2]

template<typename T , typename Allocator = std::allocator<T>>
const_reference RAJA::RAJAVec< T, Allocator >::operator[] ( difference_type  i) const
inline

◆ front() [1/2]

template<typename T , typename Allocator = std::allocator<T>>
reference RAJA::RAJAVec< T, Allocator >::front ( )
inline

Access the last item of the vector.

◆ front() [2/2]

template<typename T , typename Allocator = std::allocator<T>>
const_reference RAJA::RAJAVec< T, Allocator >::front ( ) const
inline

◆ back() [1/2]

template<typename T , typename Allocator = std::allocator<T>>
reference RAJA::RAJAVec< T, Allocator >::back ( )
inline

Access the last item of the vector.

◆ back() [2/2]

template<typename T , typename Allocator = std::allocator<T>>
const_reference RAJA::RAJAVec< T, Allocator >::back ( ) const
inline

◆ push_front() [1/2]

template<typename T , typename Allocator = std::allocator<T>>
void RAJA::RAJAVec< T, Allocator >::push_front ( const_reference  item)
inline

Add item to front end of vector. Note that this operation is unique to this class; it is not part of the C++ standard library vector interface.

◆ push_front() [2/2]

template<typename T , typename Allocator = std::allocator<T>>
void RAJA::RAJAVec< T, Allocator >::push_front ( value_type &&  item)
inline

◆ emplace_front()

template<typename T , typename Allocator = std::allocator<T>>
template<typename... Os>
void RAJA::RAJAVec< T, Allocator >::emplace_front ( Os &&...  os)
inline

◆ push_back() [1/2]

template<typename T , typename Allocator = std::allocator<T>>
void RAJA::RAJAVec< T, Allocator >::push_back ( const_reference  item)
inline

Add item to back end of vector.

◆ push_back() [2/2]

template<typename T , typename Allocator = std::allocator<T>>
void RAJA::RAJAVec< T, Allocator >::push_back ( value_type &&  item)
inline

◆ emplace_back()

template<typename T , typename Allocator = std::allocator<T>>
template<typename... Os>
void RAJA::RAJAVec< T, Allocator >::emplace_back ( Os &&...  os)
inline

◆ pop_back()

template<typename T , typename Allocator = std::allocator<T>>
void RAJA::RAJAVec< T, Allocator >::pop_back ( )
inline

Remove the last item of the vector.


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