LLVM OpenMP
kmp_vector< T, INLINE_THRESHOLD > Class Template Referencefinal

kmp_vector is a vector class for managing small vectors. More...

#include "/work/as-worker-4/publish-doxygen-docs/llvm-project/openmp/runtime/src/kmp_adt.h"

Inheritance diagram for kmp_vector< T, INLINE_THRESHOLD >:
[legend]

Public Member Functions

 ~kmp_vector ()
 kmp_vector (size_t capacity=0)
 kmp_vector (size_t capacity, const T *init_data, size_t count)
 kmp_vector (const kmp_vector &other)
 kmp_vector (kmp_vector &&other) noexcept
kmp_vectoroperator= (const kmp_vector &other)
kmp_vectoroperator= (kmp_vector &&other) noexcept
void clear ()
 Destroy all elements in the vector. Doesn't free the memory.
template<typename Fn = default_eq>
bool contains (const T &value, const Fn &comp=Fn{}) const
 Check if the vector contains the given value.
bool empty () const
template<typename Fn = default_eq>
bool is_set_equal (const kmp_vector &other, const Fn &comp=Fn{}) const
 Check if the two vectors are equal with set semantics.
void push_back (const T &value)
 Add a new element to the end of the vector.
void reserve (size_t new_capacity)
 Reserve space for the given number of elements.
size_t size () const
T & operator[] (size_t index)
const T & operator[] (size_t index) const
T * begin ()
 Iterator support (raw pointers work as iterators for contiguous storage)
T * end ()
const T * begin () const
const T * end () const

Detailed Description

template<typename T, size_t INLINE_THRESHOLD = 8>
class kmp_vector< T, INLINE_THRESHOLD >

kmp_vector is a vector class for managing small vectors.

INLINE_THRESHOLD: Number of elements in the inline array. If exceeded, the vector will grow dynamically.

Definition at line 148 of file kmp_adt.h.

Constructor & Destructor Documentation

◆ ~kmp_vector()

template<typename T, size_t INLINE_THRESHOLD = 8>
kmp_vector< T, INLINE_THRESHOLD >::~kmp_vector ( )
inline

Definition at line 228 of file kmp_adt.h.

◆ kmp_vector() [1/4]

template<typename T, size_t INLINE_THRESHOLD = 8>
kmp_vector< T, INLINE_THRESHOLD >::kmp_vector ( size_t capacity = 0)
inlineexplicit

Definition at line 230 of file kmp_adt.h.

◆ kmp_vector() [2/4]

template<typename T, size_t INLINE_THRESHOLD = 8>
kmp_vector< T, INLINE_THRESHOLD >::kmp_vector ( size_t capacity,
const T * init_data,
size_t count )
inline

Definition at line 232 of file kmp_adt.h.

◆ kmp_vector() [3/4]

template<typename T, size_t INLINE_THRESHOLD = 8>
kmp_vector< T, INLINE_THRESHOLD >::kmp_vector ( const kmp_vector< T, INLINE_THRESHOLD > & other)
inline

Definition at line 236 of file kmp_adt.h.

◆ kmp_vector() [4/4]

template<typename T, size_t INLINE_THRESHOLD = 8>
kmp_vector< T, INLINE_THRESHOLD >::kmp_vector ( kmp_vector< T, INLINE_THRESHOLD > && other)
inlinenoexcept

Definition at line 240 of file kmp_adt.h.

Member Function Documentation

◆ begin() [1/2]

template<typename T, size_t INLINE_THRESHOLD = 8>
T * kmp_vector< T, INLINE_THRESHOLD >::begin ( )
inline

Iterator support (raw pointers work as iterators for contiguous storage)

Definition at line 330 of file kmp_adt.h.

◆ begin() [2/2]

template<typename T, size_t INLINE_THRESHOLD = 8>
const T * kmp_vector< T, INLINE_THRESHOLD >::begin ( ) const
inline

Definition at line 332 of file kmp_adt.h.

◆ clear()

template<typename T, size_t INLINE_THRESHOLD = 8>
void kmp_vector< T, INLINE_THRESHOLD >::clear ( )
inline

Destroy all elements in the vector. Doesn't free the memory.

Definition at line 259 of file kmp_adt.h.

◆ contains()

template<typename T, size_t INLINE_THRESHOLD = 8>
template<typename Fn = default_eq>
bool kmp_vector< T, INLINE_THRESHOLD >::contains ( const T & value,
const Fn & comp = Fn{} ) const
inline

Check if the vector contains the given value.

If a comparator is provided, it will be used to compare the values. Otherwise, the equality operator will be used.

Definition at line 271 of file kmp_adt.h.

◆ empty()

template<typename T, size_t INLINE_THRESHOLD = 8>
bool kmp_vector< T, INLINE_THRESHOLD >::empty ( ) const
inline

Definition at line 281 of file kmp_adt.h.

◆ end() [1/2]

template<typename T, size_t INLINE_THRESHOLD = 8>
T * kmp_vector< T, INLINE_THRESHOLD >::end ( )
inline

Definition at line 331 of file kmp_adt.h.

◆ end() [2/2]

template<typename T, size_t INLINE_THRESHOLD = 8>
const T * kmp_vector< T, INLINE_THRESHOLD >::end ( ) const
inline

Definition at line 333 of file kmp_adt.h.

◆ is_set_equal()

template<typename T, size_t INLINE_THRESHOLD = 8>
template<typename Fn = default_eq>
bool kmp_vector< T, INLINE_THRESHOLD >::is_set_equal ( const kmp_vector< T, INLINE_THRESHOLD > & other,
const Fn & comp = Fn{} ) const
inline

Check if the two vectors are equal with set semantics.

Current implementation is naive O(n^2) and not optimized for performance. Handles duplicates correctly.

Definition at line 287 of file kmp_adt.h.

◆ operator=() [1/2]

template<typename T, size_t INLINE_THRESHOLD = 8>
kmp_vector & kmp_vector< T, INLINE_THRESHOLD >::operator= ( const kmp_vector< T, INLINE_THRESHOLD > & other)
inline

Definition at line 242 of file kmp_adt.h.

◆ operator=() [2/2]

template<typename T, size_t INLINE_THRESHOLD = 8>
kmp_vector & kmp_vector< T, INLINE_THRESHOLD >::operator= ( kmp_vector< T, INLINE_THRESHOLD > && other)
inlinenoexcept

Definition at line 250 of file kmp_adt.h.

◆ operator[]() [1/2]

template<typename T, size_t INLINE_THRESHOLD = 8>
T & kmp_vector< T, INLINE_THRESHOLD >::operator[] ( size_t index)
inline

Definition at line 320 of file kmp_adt.h.

◆ operator[]() [2/2]

template<typename T, size_t INLINE_THRESHOLD = 8>
const T & kmp_vector< T, INLINE_THRESHOLD >::operator[] ( size_t index) const
inline

Definition at line 324 of file kmp_adt.h.

◆ push_back()

template<typename T, size_t INLINE_THRESHOLD = 8>
void kmp_vector< T, INLINE_THRESHOLD >::push_back ( const T & value)
inline

Add a new element to the end of the vector.

Definition at line 302 of file kmp_adt.h.

◆ reserve()

template<typename T, size_t INLINE_THRESHOLD = 8>
void kmp_vector< T, INLINE_THRESHOLD >::reserve ( size_t new_capacity)
inline

Reserve space for the given number of elements.

(Note: does not shrink the vector.)

Definition at line 313 of file kmp_adt.h.

◆ size()

template<typename T, size_t INLINE_THRESHOLD = 8>
size_t kmp_vector< T, INLINE_THRESHOLD >::size ( ) const
inline

Definition at line 318 of file kmp_adt.h.


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