libcaramel
caramel::basic_dynamic_array< Any, Size, Allocator > Class Template Reference

A resizable array with a small statically allocated storage buffer. More...

#include <dynamic_array.hpp>

Public Types

using value_type = Any
 
using size_type = std::int64_t
 
using difference_type = std::ptrdiff_t
 
using allocator_type = Allocator
 
using reference = value_type &
 
using const_reference = const value_type &
 
using pointer = typename Allocator::pointer
 
using const_pointer = typename Allocator::const_pointer
 
using iterator = random_access_iterator< value_type >
 
using const_iterator = random_access_iterator< const value_type >
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 

Public Member Functions

constexpr basic_dynamic_array () noexcept=default
 Default constructor.
 
constexpr basic_dynamic_array (const allocator_type &allocator)
 Default construct the container with a given allocator. More...
 
constexpr basic_dynamic_array (size_type count, const_reference value, const allocator_type &allocator=allocator_type{})
 Construct the container with count copies of elements with value value. More...
 
constexpr basic_dynamic_array (std::initializer_list< Any > init, const allocator_type &allocator=allocator_type{})
 Construct the container with the contents of the initializer list init. More...
 
template<std::input_iterator InputIt>
constexpr basic_dynamic_array (InputIt first, InputIt last, const allocator_type &allocator=allocator_type{})
 Construct the container with the contents of the range [first, last) More...
 
constexpr basic_dynamic_array (const basic_dynamic_array &other)
 Construct the container using the contents of other. More...
 
constexpr basic_dynamic_array (const basic_dynamic_array &other, const allocator_type &allocator)
 Construct the container using the contents of other. using allocator as the allocator. More...
 
constexpr basic_dynamic_array (basic_dynamic_array &&other) noexcept
 Construct the container with the contents of the other using move semantic. After move, other is guarenteed to be empty(). More...
 
constexpr basic_dynamic_array (basic_dynamic_array &&other, const allocator_type &alloc)
 Construct the container with the contents of the other using move semantic. Using alloc as the allocator for the new container. More...
 
constexpr ~basic_dynamic_array () noexcept
 Destructor.
 
constexpr auto operator= (const basic_dynamic_array &rhs) -> basic_dynamic_array &
 Replaces the contents with an copy of the contents of rhs. More...
 
constexpr auto operator= (basic_dynamic_array &&rhs) noexcept -> basic_dynamic_array &
 Replaces the contents with those of other using move semantics. More...
 
constexpr auto operator= (std::initializer_list< Any > init_list) -> basic_dynamic_array &
 Replaces the contents with those identified by initializer list init_list. More...
 
constexpr auto allocator () const noexcept -> allocator_type
 Returns the allocator associated with the container. More...
 
constexpr auto lookup (size_type index) -> reference
 Access the object stored at a specific index. More...
 
constexpr auto lookup (size_type index) const -> const_reference
 Access the object stored at a specific index. More...
 
constexpr auto data () noexcept -> pointer
 Access the data stored by the container. More...
 
constexpr auto data () const noexcept -> const_pointer
 Access the data stored by the container. More...
 
constexpr auto begin () noexcept -> iterator
 Returns an iterator to the first element of the basic_dynamic_array. More...
 
constexpr auto begin () const noexcept -> const_iterator
 Returns an iterator to the first element of the basic_dynamic_array. More...
 
constexpr auto cbegin () const noexcept -> const_iterator
 Returns an iterator to the first element of the basic_dynamic_array. More...
 
constexpr auto end () noexcept -> iterator
 Get an iterator to the element following the last element of the basic_dynamic_array. More...
 
constexpr auto end () const noexcept -> const_iterator
 Return an iterator to the element following the last element of the basic_dynamic_array. More...
 
constexpr auto cend () const noexcept -> const_iterator
 Returns an it iterator to the element following the last element of the basic_dynamic_array. More...
 
constexpr auto rbegin () noexcept -> reverse_iterator
 Returns a reverse iterator to the first element of the reversed basic_dynamic_array. It corresponds to the last element of the non-reversed basic_dynamic_array. If the basic_dynamic_array is empty, the returned iterator is equal to rend(). More...
 
constexpr auto rbegin () const noexcept -> const_reverse_iterator
 Returns a reverse_iterator to the first element of the reversed basic_dynamic_array. It corresponds to the last element of the non-reversed basic_dynamic_array. If the basic_dynamic_array is empty, the returned iterator is equal to rend(). More...
 
constexpr auto rcbegin () const noexcept -> const_reverse_iterator
 Returns a reverse iterator to the first element of the reversed basic_dynamic_array. It corresponds to the last element of the non-reversed basic_dynamic_array. If the basic_dynamic_array is empty, the returned iterator is equal to rend(). More...
 
constexpr auto rend () noexcept -> reverse_iterator
 Returns a reverse iterator to the element following the last element of the reversed basic_dynamic_array. It corresponds to the element preceding the first element of the non-reversed basic_dynamic_array. This element acts as a placeholder, attempting to access it results in UB. More...
 
constexpr auto rend () const noexcept -> const_reverse_iterator
 Returns a reverse iterator to the element following the last element of the reversed basic_dynamic_array. It corresponds to the element preceding the first element of the non-reversed basic_dynamic_array. This element acts as a placeholder, attempting to access it results in UB. More...
 
constexpr auto rcend () const noexcept -> const_reverse_iterator
 Returns a reverse iterator to the element following the last element of the reversed basic_dynamic_array. It corresponds to the element preceding the first element of the non-reversed basic_dynamic_array. This element acts as a placeholder, attempting to access it results in UB. More...
 
constexpr auto empty () const noexcept -> bool
 Check if the basic_dynamic_array is empty. More...
 
constexpr auto size () const noexcept -> size_type
 Check the number of elements stored in the basic_dynamic_array. More...
 
constexpr auto capacity () const noexcept -> size_type
 Check the number of elements that the basic_dynamic_array has currently allocated space for. More...
 
constexpr void reserve (size_type new_cap)
 Increase the capacity of the vector to a value that's greater or equal to new_cap. If new_ap is greater than the current capacity(), new storage is allocated, otherwise the method does nothing. If reallocated occurs, all current iterators are invalidated. More...
 
constexpr void clear () noexcept
 Erases all elements from the container, After this call, size() returs zero.
 
constexpr auto insert (const_iterator pos, const_reference value) -> iterator
 Inserts an element value at the position before pos in the container. More...
 
constexpr auto insert (const_iterator pos, value_type &&value) -> iterator
 Inserts an element value at the position before pos in the container. More...
 
template<typename... Args>
constexpr auto insert (const_iterator pos, Args... args) -> iterator
 Insert a new element into the container directly before pos. The element is constructed in-place using the arguments Args... that are forwarded to the constructor. More...
 
constexpr auto insert (const_iterator pos, size_type count, const_reference value) -> iterator
 Inserts count elements from a specified value. More...
 
template<std::input_iterator InputIt>
constexpr auto insert (const_iterator pos, InputIt first, InputIt last) -> iterator
 Inserts elements from a range [first, last) before pos. More...
 
constexpr auto insert (const_iterator pos, std::initializer_list< value_type > init_list) -> iterator
 Insert elements from an initializer_list before the position pos. More...
 
constexpr auto erase (const_iterator pos) -> iterator
 Erases the specified element from the container. More...
 
constexpr auto erase (const_iterator first, const_iterator last) -> iterator
 Erases the specified elements from the container. More...
 
constexpr void append (const value_type &value)
 Appends the given element value to the end of the container. The new element is initialized as a copy of value. More...
 
constexpr void append (value_type &&value)
 Appends the given element value to the end of the container. Value is moved into the new element. More...
 
template<typename... Args>
requires constexpr std::constructible_from< value_type, Args... > auto append (in_place_t, Args &&... args) -> reference
 Appends the given element value to the end of the container. The element is constructed in-place using the arguments Args... that are forwarded to the constructor. More...
 
constexpr void pop_back ()
 Removes the last element in the container. More...
 
constexpr void resize (size_type count)
 Resizes the container to contain count elements. If the current size is greater than count, the container is reduced to its first count elements. If the current size is less than count, default constructed elements are appended. More...
 
constexpr void resize (size_type count, const_reference value)
 Resizes the container to contain count elements. If the current size is greater than count, the container is reduced to its first count elements. If the current size is less than count, additional copies of value are appended. More...
 

Detailed Description

template<typename Any, i64_t Size, typename Allocator = memory_allocator<Any>>
class caramel::basic_dynamic_array< Any, Size, Allocator >

A resizable array with a small statically allocated storage buffer.

Author
wmbat wmbat.nosp@m.@pro.nosp@m.tonma.nosp@m.il.c.nosp@m.om
Date
Sunday, 13th of december 2020
Template Parameters
AnyThe type of the elements
SizeThe size of the staticly allocated small buffer.
AllocatorThe allocator that is used to acquire/release and construct/destroy the elements in that memory.

Constructor & Destructor Documentation

◆ basic_dynamic_array() [1/8]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr caramel::basic_dynamic_array< Any, Size, Allocator >::basic_dynamic_array ( const allocator_type &  allocator)
inlineconstexpr

Default construct the container with a given allocator.

Parameters
[in]allocatorThe allocator to use for all memory allocations of this container.

◆ basic_dynamic_array() [2/8]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr caramel::basic_dynamic_array< Any, Size, Allocator >::basic_dynamic_array ( size_type  count,
const_reference  value,
const allocator_type &  allocator = allocator_type{} 
)
inlineconstexpr

Construct the container with count copies of elements with value value.

Precondition
count >= 0, otherwise UB
Parameters
[in]countThe size of the container.
[in]Thevalue to initialize elements from.
[in]allocatorThe allocator to use for all memory allocations of this container.

◆ basic_dynamic_array() [3/8]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr caramel::basic_dynamic_array< Any, Size, Allocator >::basic_dynamic_array ( std::initializer_list< Any >  init,
const allocator_type &  allocator = allocator_type{} 
)
inlineconstexpr

Construct the container with the contents of the initializer list init.

Parameters
[in]initInitializer list to initialize the elements of the container with.
[in]allocatorThe allocator to use for all memory allocations of this container.

◆ basic_dynamic_array() [4/8]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
template<std::input_iterator InputIt>
constexpr caramel::basic_dynamic_array< Any, Size, Allocator >::basic_dynamic_array ( InputIt  first,
InputIt  last,
const allocator_type &  allocator = allocator_type{} 
)
inlineconstexpr

Construct the container with the contents of the range [first, last)

Parameters
[in]firstThe first element of the range to copy from.
[in]lastOne past the last element of the range to copy from.
[in]allocatorThe allocator to use for all memory allocations of this container.

◆ basic_dynamic_array() [5/8]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr caramel::basic_dynamic_array< Any, Size, Allocator >::basic_dynamic_array ( const basic_dynamic_array< Any, Size, Allocator > &  other)
inlineconstexpr

Construct the container using the contents of other.

Parameters
[in]otherAnother container to be used as source to initialize the elements of the container with.

◆ basic_dynamic_array() [6/8]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr caramel::basic_dynamic_array< Any, Size, Allocator >::basic_dynamic_array ( const basic_dynamic_array< Any, Size, Allocator > &  other,
const allocator_type &  allocator 
)
inlineconstexpr

Construct the container using the contents of other. using allocator as the allocator.

Parameters
[in]otherAnother container to be used as source to initialize the elements of the container with.
[in]allocatorThe allocator to use for all memory allocations of this container.

◆ basic_dynamic_array() [7/8]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr caramel::basic_dynamic_array< Any, Size, Allocator >::basic_dynamic_array ( basic_dynamic_array< Any, Size, Allocator > &&  other)
inlineconstexprnoexcept

Construct the container with the contents of the other using move semantic. After move, other is guarenteed to be empty().

Parameters
[in]otheranother container to be used as source to initialize the elements of the container with.

◆ basic_dynamic_array() [8/8]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr caramel::basic_dynamic_array< Any, Size, Allocator >::basic_dynamic_array ( basic_dynamic_array< Any, Size, Allocator > &&  other,
const allocator_type &  alloc 
)
inlineconstexpr

Construct the container with the contents of the other using move semantic. Using alloc as the allocator for the new container.

Parameters
[in]otheranother container to be used as source to initialize the elements of the container with.
[in]allocatorThe allocator to use for all memory allocations of this container.

Member Function Documentation

◆ allocator()

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::allocator ( ) const -> allocator_type
inlineconstexprnoexcept

Returns the allocator associated with the container.

Returns
The associated allocator.

◆ append() [1/3]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr void caramel::basic_dynamic_array< Any, Size, Allocator >::append ( const value_type &  value)
inlineconstexpr

Appends the given element value to the end of the container. The new element is initialized as a copy of value.

Parameters
[in]valueThe value of the element to append.

◆ append() [2/3]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
template<typename... Args>
requires constexpr std::constructible_from<value_type, Args...> auto caramel::basic_dynamic_array< Any, Size, Allocator >::append ( in_place_t  ,
Args &&...  args 
) -> reference
inlineconstexpr

Appends the given element value to the end of the container. The element is constructed in-place using the arguments Args... that are forwarded to the constructor.

Parameters
[in]argsArguments to forward to the constructor of the element.

◆ append() [3/3]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr void caramel::basic_dynamic_array< Any, Size, Allocator >::append ( value_type &&  value)
inlineconstexpr

Appends the given element value to the end of the container. Value is moved into the new element.

Parameters
[in]valueThe value of the element to append.

◆ begin() [1/2]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::begin ( ) const -> const_iterator
inlineconstexprnoexcept

Returns an iterator to the first element of the basic_dynamic_array.

Returns
A const_iterator to the first element of the basic_dynamic_array. If the basic_dynamic_array is empty, the const_iterator will be equal to end().

◆ begin() [2/2]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::begin ( ) -> iterator
inlineconstexprnoexcept

Returns an iterator to the first element of the basic_dynamic_array.

Returns
An iterator to the first element of the basic_dynamic_array. If the basic_dynamic_array is empty, the iterator will be equal to end().

◆ capacity()

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::capacity ( ) const -> size_type
inlineconstexprnoexcept

Check the number of elements that the basic_dynamic_array has currently allocated space for.

Returns
Capacity of the currently allocated storage.

◆ cbegin()

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::cbegin ( ) const -> const_iterator
inlineconstexprnoexcept

Returns an iterator to the first element of the basic_dynamic_array.

Returns
iterator to the first element. If the basic_dynamic_array is empty, the const_iterator will be equal to end().

◆ cend()

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::cend ( ) const -> const_iterator
inlineconstexprnoexcept

Returns an it iterator to the element following the last element of the basic_dynamic_array.

Returns
iterator to the element following the last element. Attempting to access it results in undefined behaviour.

◆ data() [1/2]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::data ( ) const -> const_pointer
inlineconstexprnoexcept

Access the data stored by the container.

Returns
A const_pointer to the first element in the container. If no elements are in the container, the pointer will be null.

◆ data() [2/2]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::data ( ) -> pointer
inlineconstexprnoexcept

Access the data stored by the container.

Returns
A pointer to the first element in the container. If no elements are in the container, the pointer will be null.

◆ empty()

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::empty ( ) const -> bool
inlineconstexprnoexcept

Check if the basic_dynamic_array is empty.

Returns
True if the container is empty, false otherwise.

◆ end() [1/2]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::end ( ) const -> const_iterator
inlineconstexprnoexcept

Return an iterator to the element following the last element of the basic_dynamic_array.

Returns
iterator to the element following the last element. Attempting to access it results in undefined behaviour.

◆ end() [2/2]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::end ( ) -> iterator
inlineconstexprnoexcept

Get an iterator to the element following the last element of the basic_dynamic_array.

Returns
iterator to the element following the last element. Attempting to access it results in undefined behaviour.

◆ erase() [1/2]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::erase ( const_iterator  first,
const_iterator  last 
) -> iterator
inlineconstexpr

Erases the specified elements from the container.

Precondition
first >= begin()
last <= end()
first >= last
Parameters
[in]firstThe first element of the range to copy from.
[in]lastOne past the last element of the range to copy from.
Returns
Iterator following the last removed element. If last == end() prior to removal, then the updated end() iterator is returned. If [first, last) is an empty range, the last iterator is returned.

◆ erase() [2/2]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::erase ( const_iterator  pos) -> iterator
inlineconstexpr

Erases the specified element from the container.

Precondition
pos >= begin()
pos <= end()
Parameters
[in]posIterator to the element to remove.

◆ insert() [1/6]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
template<typename... Args>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::insert ( const_iterator  pos,
Args...  args 
) -> iterator
inlineconstexpr

Insert a new element into the container directly before pos. The element is constructed in-place using the arguments Args... that are forwarded to the constructor.

Precondition
pos >= begin()
pos <= end()
Parameters
[in]posIterator before which the content will be inserted. pos may be the end()
[in]argsArguments to forward to the constructor of the element.
Returns
Iterator pointing to the inserted value.

◆ insert() [2/6]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::insert ( const_iterator  pos,
const_reference  value 
) -> iterator
inlineconstexpr

Inserts an element value at the position before pos in the container.

Precondition
pos >= begin()
pos <= end()
Parameters
[in]posIterator before which the content will be inserted. pos may be the end() iterator.
[in]valueElement value to insert.
Returns
Iterator pointing to the inserted value.

◆ insert() [3/6]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
template<std::input_iterator InputIt>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::insert ( const_iterator  pos,
InputIt  first,
InputIt  last 
) -> iterator
inlineconstexpr

Inserts elements from a range [first, last) before pos.

Precondition
pos >= begin()
pos <= end()
Parameters
[in]posIterator before which the content will be inserted. pos may be the end() iterator.
[in]firstThe first value to insert
[in]lastOne past the last value to insert.
Returns
Iterator pointing to the first element inserted.

◆ insert() [4/6]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::insert ( const_iterator  pos,
size_type  count,
const_reference  value 
) -> iterator
inlineconstexpr

Inserts count elements from a specified value.

Precondition
pos >= begin()
pos <= end()
Parameters
[in]posIterator before which the content will be inserted. pos may be the end() iterator.
[in]countThe number of elements to insert.
[in]valueElement value to insert.
Returns
Iterator pointing to the first element inserted.

◆ insert() [5/6]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::insert ( const_iterator  pos,
std::initializer_list< value_type >  init_list 
) -> iterator
inlineconstexpr

Insert elements from an initializer_list before the position pos.

Precondition
pos >= begin()
pos <= end()
Parameters
[in]posIterator before which the content will be inserted. pos may be the end() iterator.
[in]init_listInitializer list to insert the values from.
Returns
Iterator pointing to the first element inserted.

◆ insert() [6/6]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::insert ( const_iterator  pos,
value_type &&  value 
) -> iterator
inlineconstexpr

Inserts an element value at the position before pos in the container.

Precondition
pos >= begin()
pos <= end()
Parameters
[in]posIterator before which the content will be inserted. pos may be the end() iterator.
[in]valueElement value to insert.
Returns
Iterator pointing to the inserted value.

◆ lookup() [1/2]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::lookup ( size_type  index) -> reference
inlineconstexpr

Access the object stored at a specific index.

Precondition
'index < size()'.
'index >= 0'.
Parameters
[in]indexThe position to lookup the object in the array
Returns
A reference to the object stored at index.

◆ lookup() [2/2]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::lookup ( size_type  index) const -> const_reference
inlineconstexpr

Access the object stored at a specific index.

Precondition
'index < size()'.
'index >= 0'.
Parameters
[in]indexThe position to lookup the object in the array
Returns
A const reference to the object stored at index.

◆ operator=() [1/3]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::operator= ( basic_dynamic_array< Any, Size, Allocator > &&  rhs) -> basic_dynamic_array&
inlineconstexprnoexcept

Replaces the contents with those of other using move semantics.

Parameters
[in]rhsother container to use as a data source.

◆ operator=() [2/3]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::operator= ( const basic_dynamic_array< Any, Size, Allocator > &  rhs) -> basic_dynamic_array&
inlineconstexpr

Replaces the contents with an copy of the contents of rhs.

Parameters
[in]rhsother container to use as a data source.

◆ operator=() [3/3]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::operator= ( std::initializer_list< Any >  init_list) -> basic_dynamic_array&
inlineconstexpr

Replaces the contents with those identified by initializer list init_list.

Parameters
init_listInitializer list to use as data source.

◆ pop_back()

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr void caramel::basic_dynamic_array< Any, Size, Allocator >::pop_back ( )
inlineconstexpr

Removes the last element in the container.

Precondition
size() != 0

◆ rbegin() [1/2]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::rbegin ( ) const -> const_reverse_iterator
inlineconstexprnoexcept

Returns a reverse_iterator to the first element of the reversed basic_dynamic_array. It corresponds to the last element of the non-reversed basic_dynamic_array. If the basic_dynamic_array is empty, the returned iterator is equal to rend().

Returns
reverse_iterator to the first element.

◆ rbegin() [2/2]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::rbegin ( ) -> reverse_iterator
inlineconstexprnoexcept

Returns a reverse iterator to the first element of the reversed basic_dynamic_array. It corresponds to the last element of the non-reversed basic_dynamic_array. If the basic_dynamic_array is empty, the returned iterator is equal to rend().

Returns
Reverse iterator to the first element.

◆ rcbegin()

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::rcbegin ( ) const -> const_reverse_iterator
inlineconstexprnoexcept

Returns a reverse iterator to the first element of the reversed basic_dynamic_array. It corresponds to the last element of the non-reversed basic_dynamic_array. If the basic_dynamic_array is empty, the returned iterator is equal to rend().

Returns
Reverse iterator to the first element.

◆ rcend()

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::rcend ( ) const -> const_reverse_iterator
inlineconstexprnoexcept

Returns a reverse iterator to the element following the last element of the reversed basic_dynamic_array. It corresponds to the element preceding the first element of the non-reversed basic_dynamic_array. This element acts as a placeholder, attempting to access it results in UB.

Returns
Reverse iterator to the element following the last element.

◆ rend() [1/2]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::rend ( ) const -> const_reverse_iterator
inlineconstexprnoexcept

Returns a reverse iterator to the element following the last element of the reversed basic_dynamic_array. It corresponds to the element preceding the first element of the non-reversed basic_dynamic_array. This element acts as a placeholder, attempting to access it results in UB.

Returns
Reverse iterator to the element following the last element.

◆ rend() [2/2]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::rend ( ) -> reverse_iterator
inlineconstexprnoexcept

Returns a reverse iterator to the element following the last element of the reversed basic_dynamic_array. It corresponds to the element preceding the first element of the non-reversed basic_dynamic_array. This element acts as a placeholder, attempting to access it results in UB.

Returns
Reverse iterator to the element following the last element.

◆ reserve()

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr void caramel::basic_dynamic_array< Any, Size, Allocator >::reserve ( size_type  new_cap)
inlineconstexpr

Increase the capacity of the vector to a value that's greater or equal to new_cap. If new_ap is greater than the current capacity(), new storage is allocated, otherwise the method does nothing. If reallocated occurs, all current iterators are invalidated.

Parameters
new_capNew capacity of the vector.
Exceptions
Ifthe undelying allocator failed to allocate memory.

◆ resize() [1/2]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr void caramel::basic_dynamic_array< Any, Size, Allocator >::resize ( size_type  count)
inlineconstexpr

Resizes the container to contain count elements. If the current size is greater than count, the container is reduced to its first count elements. If the current size is less than count, default constructed elements are appended.

Parameters
[in]countNew size of the container.

◆ resize() [2/2]

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr void caramel::basic_dynamic_array< Any, Size, Allocator >::resize ( size_type  count,
const_reference  value 
)
inlineconstexpr

Resizes the container to contain count elements. If the current size is greater than count, the container is reduced to its first count elements. If the current size is less than count, additional copies of value are appended.

Parameters
[in]countNew size of the container.
[in]valueThe value to initialize new elements with.

◆ size()

template<typename Any , i64_t Size, typename Allocator = memory_allocator<Any>>
constexpr auto caramel::basic_dynamic_array< Any, Size, Allocator >::size ( ) const -> size_type
inlineconstexprnoexcept

Check the number of elements stored in the basic_dynamic_array.

Returns
The number of elements in the basic_dynamic_array.

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