WPILibC++ 2025.1.1
Loading...
Searching...
No Matches
wpi::memory::joint_array< T > Class Template Reference

A zero overhead dynamic array using joint memory. More...

#include <wpi/memory/joint_allocator.hpp>

Public Types

using value_type = T
 
using iterator = value_type*
 
using const_iterator = const value_type*
 

Public Member Functions

template<typename JointType >
 joint_array (std::size_t size, joint_type< JointType > &j)
 
template<typename JointType >
 joint_array (std::size_t size, const value_type &val, joint_type< JointType > &j)
 
template<typename JointType >
 joint_array (std::initializer_list< value_type > ilist, joint_type< JointType > &j)
 
template<typename InIter , typename JointType , typename = decltype(*std::declval<InIter&>()++)>
 joint_array (InIter begin, InIter end, joint_type< JointType > &j)
 
 joint_array (const joint_array &)=delete
 
template<typename JointType >
 joint_array (const joint_array &other, joint_type< JointType > &j)
 
 joint_array (joint_array &&)=delete
 
template<typename JointType >
 joint_array (joint_array &&other, joint_type< JointType > &j)
 
 ~joint_array () noexcept
 
joint_arrayoperator= (const joint_array &)=delete
 
joint_arrayoperator= (joint_array &&)=delete
 
std::size_t size () const noexcept
 
bool empty () const noexcept
 
value_typeoperator[] (std::size_t i) noexcept
 
const value_typeoperator[] (std::size_t i) const noexcept
 
value_typedata () noexcept
 
const value_typedata () const noexcept
 
iterator begin () noexcept
 
const_iterator begin () const noexcept
 
iterator end () noexcept
 
const_iterator end () const noexcept
 

Detailed Description

template<typename T>
class wpi::memory::joint_array< T >

A zero overhead dynamic array using joint memory.

If you use, e.g. std::vector with joint_allocator, this has a slight additional overhead. This type is joint memory aware and has no overhead.

It has a dynamic, but fixed size, it cannot grow after it has been created.

Member Typedef Documentation

◆ const_iterator

template<typename T >
using wpi::memory::joint_array< T >::const_iterator = const value_type*

◆ iterator

template<typename T >
using wpi::memory::joint_array< T >::iterator = value_type*

◆ value_type

template<typename T >
using wpi::memory::joint_array< T >::value_type = T

Constructor & Destructor Documentation

◆ joint_array() [1/8]

template<typename T >
template<typename JointType >
wpi::memory::joint_array< T >::joint_array ( std::size_t size,
joint_type< JointType > & j )
inline
Effects:
Creates with size default-constructed objects using the specified joint memory.
Throws:
out_of_fixed_memory if size is too big and anything thrown by Ts constructor. If an allocation is thrown, the memory will be released directly.

◆ joint_array() [2/8]

template<typename T >
template<typename JointType >
wpi::memory::joint_array< T >::joint_array ( std::size_t size,
const value_type & val,
joint_type< JointType > & j )
inline
Effects:
Creates with size copies of val using the specified joint memory.
Throws:
out_of_fixed_memory if size is too big and anything thrown by Ts constructor. If an allocation is thrown, the memory will be released directly.

◆ joint_array() [3/8]

template<typename T >
template<typename JointType >
wpi::memory::joint_array< T >::joint_array ( std::initializer_list< value_type > ilist,
joint_type< JointType > & j )
inline
Effects:
Creates with the copies of the objects in the initializer list using the specified joint memory.
Throws:
out_of_fixed_memory if the size is too big and anything thrown by Ts constructor. If an allocation is thrown, the memory will be released directly.

◆ joint_array() [4/8]

template<typename T >
template<typename InIter , typename JointType , typename = decltype(*std::declval<InIter&>()++)>
wpi::memory::joint_array< T >::joint_array ( InIter begin,
InIter end,
joint_type< JointType > & j )
inline
Effects:
Creates it by forwarding each element of the range to Ts constructor using the specified joint memory.
Throws:
out_of_fixed_memory if the size is too big and anything thrown by Ts constructor. If an allocation is thrown, the memory will be released directly.

◆ joint_array() [5/8]

template<typename T >
wpi::memory::joint_array< T >::joint_array ( const joint_array< T > & )
delete

◆ joint_array() [6/8]

template<typename T >
template<typename JointType >
wpi::memory::joint_array< T >::joint_array ( const joint_array< T > & other,
joint_type< JointType > & j )
inline
Effects:
Copy constructs each element from other into the storage of the specified joint memory.
Throws:
out_of_fixed_memory if the size is too big and anything thrown by Ts constructor. If an allocation is thrown, the memory will be released directly.

◆ joint_array() [7/8]

template<typename T >
wpi::memory::joint_array< T >::joint_array ( joint_array< T > && )
delete

◆ joint_array() [8/8]

template<typename T >
template<typename JointType >
wpi::memory::joint_array< T >::joint_array ( joint_array< T > && other,
joint_type< JointType > & j )
inline
Effects:
Move constructs each element from other into the storage of the specified joint memory.
Throws:
out_of_fixed_memory if the size is too big and anything thrown by Ts constructor. If an allocation is thrown, the memory will be released directly.

◆ ~joint_array()

template<typename T >
wpi::memory::joint_array< T >::~joint_array ( )
inlinenoexcept
Effects:
Destroys all objects, but does not release the storage.

Member Function Documentation

◆ begin() [1/2]

template<typename T >
const_iterator wpi::memory::joint_array< T >::begin ( ) const
inlinenoexcept

◆ begin() [2/2]

template<typename T >
iterator wpi::memory::joint_array< T >::begin ( )
inlinenoexcept
Returns:
A random access iterator to the first element.

◆ data() [1/2]

template<typename T >
const value_type * wpi::memory::joint_array< T >::data ( ) const
inlinenoexcept

◆ data() [2/2]

template<typename T >
value_type * wpi::memory::joint_array< T >::data ( )
inlinenoexcept
Returns:
A pointer to the first object. It points to contiguous memory and can be used to access the objects directly.

◆ empty()

template<typename T >
bool wpi::memory::joint_array< T >::empty ( ) const
inlinenoexcept
Returns:
true if the array is empty, false otherwise.

◆ end() [1/2]

template<typename T >
const_iterator wpi::memory::joint_array< T >::end ( ) const
inlinenoexcept

◆ end() [2/2]

template<typename T >
iterator wpi::memory::joint_array< T >::end ( )
inlinenoexcept
Returns:
A random access iterator one past the last element.

◆ operator=() [1/2]

template<typename T >
joint_array & wpi::memory::joint_array< T >::operator= ( const joint_array< T > & )
delete

◆ operator=() [2/2]

template<typename T >
joint_array & wpi::memory::joint_array< T >::operator= ( joint_array< T > && )
delete

◆ operator[]() [1/2]

template<typename T >
const value_type & wpi::memory::joint_array< T >::operator[] ( std::size_t i) const
inlinenoexcept

◆ operator[]() [2/2]

template<typename T >
value_type & wpi::memory::joint_array< T >::operator[] ( std::size_t i)
inlinenoexcept
Returns:
A reference to the ith object.
Requires:
i < size().

◆ size()

template<typename T >
std::size_t wpi::memory::joint_array< T >::size ( ) const
inlinenoexcept
Returns:
The number of elements in the array.

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