jaulib v1.3.6
Jau Support Library (C++, Java, ..)
Loading...
Searching...
No Matches
jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem > Class Template Reference

Implementation of a dynamic linear array storage, aka vector, including relative positional access. More...

#include <darray.hpp>

Inheritance diagram for jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >:
Collaboration diagram for jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >:

Public Types

typedef Alloc_type allocator_type
 
typedef const value_typeconst_iterator
 
typedef const value_typeconst_pointer
 
typedef const value_typeconst_reference
 
typedef bool darray_tag
 Used to determine whether this type is a darray or has a darray, see is_darray_type<T>
 
typedef std::make_signed_t< size_typedifference_type
 
typedef bool(* equal_comparator) (const value_type &a, const value_type &b)
 Generic value_type equal comparator to be user defined for e.g.
 
typedef value_typeiterator
 
typedef value_typepointer
 
typedef value_typereference
 
typedef darray< value_type, size_type, allocator_type, use_memmove, use_secmem > self_t
 
typedef Size_type size_type
 
typedef Value_type value_type
 

Public Member Functions

constexpr darray () noexcept
 Default constructor, giving zero capacity and zero memory footprint.
 
constexpr darray (const darray &x)
 Creates a new instance, copying all elements from the given darray.
 
constexpr darray (const darray &x, const float growth_factor, const allocator_type &alloc)
 Creates a new instance, copying all elements from the given darray.
 
constexpr darray (const darray &x, const size_type _capacity, const float growth_factor, const allocator_type &alloc)
 Creates a new instance with custom initial storage capacity, copying all elements from the given darray.
 
constexpr darray (const size_type _capacity, const_iterator first, const_iterator last, const float growth_factor=DEFAULT_GROWTH_FACTOR, const allocator_type &alloc=allocator_type())
 Creates a new instance with custom initial storage capacity, copying all elements from the given const_iterator value_type range [first, last).
 
template<class InputIt>
constexpr darray (const size_type _capacity, InputIt first, InputIt last, const float growth_factor=DEFAULT_GROWTH_FACTOR, const allocator_type &alloc=allocator_type())
 Creates a new instance with custom initial storage capacity, copying all elements from the given template input-iterator value_type range [first, last).
 
constexpr darray (darray &&x) noexcept
 
constexpr darray (darray &&x, const float growth_factor, const allocator_type &alloc) noexcept
 
template<class InputIt>
constexpr darray (InputIt first, InputIt last, const allocator_type &alloc=allocator_type())
 Creates a new instance, copying all elements from the given template input-iterator value_type range [first, last).
 
constexpr darray (size_type capacity, const float growth_factor=DEFAULT_GROWTH_FACTOR, const allocator_type &alloc=allocator_type())
 Creating an empty instance with initial capacity and other (default) properties.
 
constexpr darray (std::initializer_list< value_type > initlist, const allocator_type &alloc=allocator_type())
 Create a new instance from an initializer list.
 
constexpr darray (std::nullptr_t, size_type size, value_type value=value_type(), const float growth_factor=DEFAULT_GROWTH_FACTOR, const allocator_type &alloc=allocator_type())
 Creating a sized instance with initial size elements with default value.
 
 ~darray () noexcept
 
constexpr void assign (const_iterator first, const_iterator last)
 Like std::vector::assign(), but non-template overload using const_iterator.
 
template<class InputIt>
constexpr void assign (InputIt first, InputIt last)
 Like std::vector::assign()
 
constexpr_cxx20 reference at (size_type i)
 Like std::vector::at(size_type), mutable reference.
 
constexpr_cxx20 const_reference at (size_type i) const
 Like std::vector::at(size_type), immutable reference.
 
constexpr reference back ()
 Like std::vector::back(), mutable access.
 
constexpr const_reference back () const
 Like std::vector::back(), immutable access.
 
constexpr const_iterator begin () const noexcept
 
constexpr iterator begin () noexcept
 
constexpr size_type capacity () const noexcept
 Return the current capacity.
 
constexpr bool capacity_reached () const noexcept
 Returns true if capacity has been reached and the next push_back() will grow the storage and invalidates all iterators and references.
 
constexpr const_iterator cbegin () const noexcept
 
constexpr const_iterator cend () const noexcept
 
const jau::type_infoclassSignature () const noexcept
 Returns type signature of implementing class.
 
constexpr self_tclear () noexcept
 Like std::vector::clear(), calls destructor on all elements and leaving capacity unchanged.
 
constexpr self_tclear (bool releaseMem) noexcept
 Like std::vector::clear(), calls destructor on all elements.
 
constexpr self_tclearPosition () noexcept
 Clears the relative position and limit w/o destructing elements nor mutating storage.
 
constexpr const_pointer data () const noexcept
 Like std::vector::data(), const immutable pointer.
 
constexpr pointer data () noexcept
 Like std::vector::data(), mutable pointer.
 
self_t duplicate ()
 Returns a duplicate with same position and limit.
 
template<typename... Args>
constexpr iterator emplace (const_iterator pos, Args &&... args)
 Like std::vector::emplace(), construct a new element in place.
 
template<typename... Args>
constexpr reference emplace_back (Args &&... args)
 Like std::vector::emplace_back(), construct a new element in place at the end().
 
constexpr bool empty () const noexcept
 Like std::vector::empty().
 
constexpr const_iterator end () const noexcept
 
constexpr iterator end () noexcept
 
constexpr iterator erase (const size_type first_idx, const size_type last_idx)
 Similar to std::vector::erase() using indices, removes the elements in the range [first_idx, last_idx).
 
constexpr iterator erase (const size_type pos_idx)
 Similar to std::vector::erase() using an index, removes the elements at pos_idx.
 
constexpr iterator erase (const_iterator cfirst, const_iterator clast)
 Like std::vector::erase(), removes the elements in the range [first, last).
 
constexpr iterator erase (const_iterator cpos)
 Like std::vector::erase(), removes the elements at pos.
 
template<class UnaryPredicate>
constexpr size_type erase_if (const bool all_matching, UnaryPredicate p)
 Erase either the first matching element or all matching elements.
 
constexpr size_type erase_matching (const value_type &x, const bool all_matching, equal_comparator comparator)
 Erase either the first matching element or all matching elements using erase().
 
constexpr self_tflip () noexcept
 Sets limit to position and position to zero.
 
constexpr reference front ()
 Like std::vector::front(), mutable access.
 
constexpr const_reference front () const
 Like std::vector::front(), immutable access.
 
constexpr_cxx20 const_reference get ()
 Relative get() for single value reference, increasing position() by one.
 
allocator_type get_allocator () const noexcept
 
const allocator_typeget_allocator_ref () const noexcept
 
constexpr size_type get_grown_capacity (size_type add=1) const noexcept
 Return the current capacity() multiplied by the growth factor, minimum is max(capacity()+add, 10).
 
std::string getInfo () const noexcept
 
constexpr float growthFactor () const noexcept
 Returns growth factor, see setGrowthFactor() for semantics.
 
constexpr bool hasRemaining () const noexcept
 Returns whether position < limit, i.e.
 
constexpr iterator insert (const size_type pos_idx, const value_type &x)
 Similar to std::vector::insert() using an index, copy.
 
constexpr iterator insert (const_iterator pos, const value_type &x)
 Like std::vector::insert(), copy.
 
template<class InputIt>
constexpr iterator insert (const_iterator pos, InputIt first, InputIt last)
 Like std::vector::insert(), inserting the value_type range [first, last).
 
constexpr iterator insert (const_iterator pos, value_type &&x)
 Like std::vector::insert(), move.
 
constexpr size_type limit () const noexcept
 Read/write limit, one element beyond maximum index with limit <= size/end.
 
constexpr const_pointer limit_ptr () const noexcept
 Pointer to immutable read/write limit, one element beyond maximum element with limit <= size/end.
 
constexpr size_type max_size () const noexcept
 Returns std::numeric_limits<difference_type>::max() as the maximum array size.
 
constexpr darrayoperator= (const darray &x)
 Like std::vector::operator=(&), assignment.
 
constexpr darrayoperator= (darray &&x) noexcept
 Like std::vector::operator=(&&), move.
 
constexpr_cxx20 const_reference operator[] (size_type i) const noexcept
 Like std::vector::operator[](size_type), immutable reference.
 
constexpr_cxx20 reference operator[] (size_type i) noexcept
 Like std::vector::operator[](size_type), mutable reference.
 
constexpr bool pinned () const
 Returns true if growthFactor() < 1, otherwise false.
 
constexpr void pop_back () noexcept
 Like std::vector::pop_back().
 
constexpr size_type position () const noexcept
 Next relative read/write element index, with 0 <= position <= limit.
 
constexpr const_pointer position_ptr () const noexcept
 Pointer to immutable next relative read/write element index, with 0 <= position <= limit.
 
constexpr pointer position_ptr () noexcept
 Pointer to mutable next relative read/write element index, with 0 <= position <= limit.
 
constexpr void push_back (const value_type &x)
 Like std::vector::push_back(), copy.
 
template<class InputIt>
constexpr void push_back (InputIt first, InputIt last)
 Like std::vector::push_back(), but appends the value_type range [first, last).
 
constexpr void push_back (value_type &&x)
 Like std::vector::push_back(), move.
 
template<typename... Args>
constexpr void push_back_list (Args &&... args)
 Like push_back(), but for more multiple r-value references to move.
 
template<typename... Args>
constexpr void push_back_list (const Args &... args)
 Like push_back(), but for more multiple const r-value to copy.
 
constexpr bool push_back_unique (const value_type &x, equal_comparator comparator)
 Like std::vector::push_back(), but only if the newly added element does not yet exist.
 
constexpr void push_front (const value_type &x)
 Like std::vector::push_front(), copy.
 
constexpr void push_front (value_type &&x)
 Like std::vector::push_front(), move.
 
constexpr_cxx20 self_tput (const_reference v, Bool grow=Bool::False)
 Relative put() for single value, increasing position().
 
template<typename... Targs, std::enable_if_t< jau::is_all_same_v< Targs... > &&sizeof(Value_type) > = sizeof(jau::first_type<Targs...>) && std::is_assignable_v<value_type&, jau::first_type<Targs...>>, bool>
constexpr_cxx20 self_tputN (Bool grow, const Targs &...args)
 Relative put() for multiple value of an assignable type fitting into value_type, increasing position().
 
constexpr size_type remaining () const noexcept
 Returns limit - position.
 
constexpr self_treserve (size_type new_capacity)
 Like std::vector::reserve(), increases this instance's capacity to new_capacity.
 
constexpr self_tresize (size_type new_size)
 Like std::vector::resize(size_type)
 
constexpr self_tresize (size_type new_size, const value_type &val)
 Like std::vector::resize(size_type, const value_type&)
 
constexpr self_trewind () noexcept
 Sets position to zero.
 
constexpr void setGrowthFactor (float v) noexcept
 Sets the growth factor when size() == capacity() is reached for growing operations, defaults to golden ratio DEFAULT_GROWTH_FACTOR.
 
self_tsetLimit (size_type v)
 Sets new limit and adjusts position if new limit is below.
 
self_tsetPosition (size_type v)
 Sets position.
 
constexpr bool shared () const
 Returns true if growthFactor() < 0, otherwise false.
 
constexpr self_tshrink_to_fit ()
 Like std::vector::shrink_to_fit(), but ensured constexpr.
 
constexpr size_type size () const noexcept
 Like std::vector::size().
 
self_t slice ()
 Returns a sliced duplicate starting from this buffers' current position.
 
self_t slice (size_type idx, size_type length)
 Returns a sliced duplicate starting from the given idx.
 
constexpr void swap (darray &x) noexcept
 Like std::vector::swap().
 
std::string toString () const noexcept
 
const jau::type_infovalueSignature () const noexcept
 Returns type signature of implementing class's stored value type.
 

Static Public Attributes

static constexpr const float DEFAULT_GROWTH_FACTOR = std::numbers::phi_v<float>
 Default growth factor using the golden ratio 1.618.
 
static constexpr const bool uses_memmove = use_memmove
 
static constexpr const bool uses_realloc = use_memmove && std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>
 
static constexpr const bool uses_secmem = use_secmem
 

Protected Member Functions

constexpr darray (darray &parent, pointer begin, pointer position, pointer limit, size_type size)
 Slicing ctor.
 

Detailed Description

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
class jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >

Implementation of a dynamic linear array storage, aka vector, including relative positional access.

Goals are to support a high-performance CoW dynamic array implementation, jau::cow_darray,
exposing fine grained control over its underlying storage facility.
Further, jau::darray provides high-performance and efficient storage properties on its own.

This class shall be compliant with C++ named requirements for Container.

API and design differences to std::vector

Implementation differences to std::vector and some details

  • Using zero overhead value_type* as iterator type.
  • ...
  • Storage is operated on three iterator: begin <= end <= storage_end.
  • Constructs and destructs value_type via placement new within the pre-allocated array capacity. Latter is managed via allocator_type.

Relative access

Additionally to the ransom access, relative positional access via get(), put(), putN() and position(), limit(), remaining(), clearPosition() is supported, as well as slice() and duplicate().

0 <= position <= limit <= size <= capacity

All mutable relative accessors validate range and throw jau::IndexOutOfBoundsError, similar to the at() method.

Non-Type Template Parameter (NTTP) controlling Value_type memory

use_memmove

use_memmove can be overriden and defaults to std::is_trivially_copyable_v<Value_type>.

The default value has been chosen with care, see C++ Standard section 6.9 Types TriviallyCopyable.

See Trivial destructor being key requirement to TriviallyCopyable.

A trivial destructor is a destructor that performs no action. Objects with trivial destructors don't require a delete-expression and may be disposed of by simply deallocating their storage. All data types compatible with the C language (POD types) are trivially destructible. </blockquote>\ilinebr However, since the destructor is not being called when usingmemmove` on elements within this container, the requirements are more relaxed and TriviallyCopyable not required nor guaranteed, see below.

memmove will be used to move an object inside this container memory only, i.e. where construction and destruction is controlled. Not requiring TriviallyCopyable constraints memmove as follows:

  • We can't memmove one or more objects into this container, even with an rvalue reference. The rvalue's destructor will be called and potential acquired resources are lost.
  • We can memmove an object around within this container, i.e. when growing or shrinking the array. (Used)
  • We can memmove an object out of this container to the user. (Unused)

Relaxed requirements for use_memmove are:

  • Not using inner class pointer to inner class fields or methods (like launching a thread).
  • TBD ???

Since element pointer and iterator are always invalidated for container after storage mutation, above constraints are not really anything novel and go along with normal std::vector.

Users may include typedef container_memmove_compliant in their Value_type class to enforce use_memmove as follows:

  • typedef std::true_type container_memmove_compliant;

use_secmem

use_secmem can be overriden and defaults to false.

use_secmem, if enabled, ensures that the underlying memory will be zeroed out after use and element erasure.

Users may include typedef enforce_secmem in their Value_type class to enforce use_secmem as follows:

  • typedef std::true_type enforce_secmem;
See also
cow_darray
Examples
test_cow_iterator_01.cpp.

Definition at line 152 of file darray.hpp.

Member Typedef Documentation

◆ value_type

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
typedef Value_type jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::value_type

Definition at line 164 of file darray.hpp.

◆ pointer

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
typedef value_type* jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::pointer

Definition at line 165 of file darray.hpp.

◆ const_pointer

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
typedef const value_type* jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::const_pointer

Definition at line 166 of file darray.hpp.

◆ reference

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
typedef value_type& jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::reference

Definition at line 167 of file darray.hpp.

◆ const_reference

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
typedef const value_type& jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::const_reference

Definition at line 168 of file darray.hpp.

◆ iterator

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
typedef value_type* jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::iterator

Definition at line 169 of file darray.hpp.

◆ const_iterator

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
typedef const value_type* jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::const_iterator

Definition at line 170 of file darray.hpp.

◆ size_type

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
typedef Size_type jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::size_type

Definition at line 171 of file darray.hpp.

◆ difference_type

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
typedef std::make_signed_t<size_type> jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::difference_type

Definition at line 172 of file darray.hpp.

◆ allocator_type

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
typedef Alloc_type jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::allocator_type

Definition at line 175 of file darray.hpp.

◆ self_t

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
typedef darray<value_type, size_type, allocator_type, use_memmove, use_secmem> jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::self_t

Definition at line 179 of file darray.hpp.

◆ darray_tag

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
typedef bool jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::darray_tag

Used to determine whether this type is a darray or has a darray, see is_darray_type<T>

Definition at line 182 of file darray.hpp.

◆ equal_comparator

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
typedef bool(* jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::equal_comparator) (const value_type &a, const value_type &b)

Generic value_type equal comparator to be user defined for e.g.

jau::darray::push_back_unique().

Parameters
aone element of the equality test.
bthe other element of the equality test.
Returns
true if both are equal

Definition at line 1671 of file darray.hpp.

Constructor & Destructor Documentation

◆ darray() [1/13]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::darray ( darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem > & parent,
pointer begin,
pointer position,
pointer limit,
size_type size )
inlineexplicitconstexprprotected

Slicing ctor.

Marks the created buffer shared() and pinned() and the given parent pinned().

Definition at line 529 of file darray.hpp.

◆ darray() [2/13]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::darray ( )
inlineconstexprnoexcept

Default constructor, giving zero capacity and zero memory footprint.

Definition at line 548 of file darray.hpp.

Here is the caller graph for this function:

◆ darray() [3/13]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::darray ( size_type capacity,
const float growth_factor = DEFAULT_GROWTH_FACTOR,
const allocator_type & alloc = allocator_type() )
inlineexplicitconstexpr

Creating an empty instance with initial capacity and other (default) properties.

Parameters
capacityinitial capacity of the new instance.
growth_factorgiven growth factor, defaults to DEFAULT_GROWTH_FACTOR. See setGrowthFactor().
allocgiven allocator_type, defaults to allocator_type()

Definition at line 562 of file darray.hpp.

◆ darray() [4/13]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::darray ( std::nullptr_t ,
size_type size,
value_type value = value_type(),
const float growth_factor = DEFAULT_GROWTH_FACTOR,
const allocator_type & alloc = allocator_type() )
inlineexplicitconstexpr

Creating a sized instance with initial size elements with default value.

Parameters
std::nullptr_targument to distinguish constructor argument overload
sizeinitial capacity and size of new instance
valueinitial value for the size elements, defaults to value_type()
growth_factorgiven growth factor, defaults to DEFAULT_GROWTH_FACTOR. See setGrowthFactor().
allocgiven allocator_type, defaults to allocator_type()

Definition at line 578 of file darray.hpp.

◆ darray() [5/13]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::darray ( const darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem > & x)
inlineconstexpr

Creates a new instance, copying all elements from the given darray.


Capacity and size will equal the given array, i.e. the result is a trimmed jau::darray.

Throws jau::IllegalStateError if the source instance is sliced, i.e. sharing memory

Parameters
xthe given darray, all elements will be copied into the new instance.

Definition at line 597 of file darray.hpp.

◆ darray() [6/13]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::darray ( const darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem > & x,
const float growth_factor,
const allocator_type & alloc )
inlineexplicitconstexpr

Creates a new instance, copying all elements from the given darray.


Capacity and size will equal the given array, i.e. the result is a trimmed jau::darray.

Throws jau::IllegalStateError if the source instance is sliced, i.e. sharing memory

Parameters
xthe given darray, all elements will be copied into the new instance.
growth_factorcustom growth factor
alloccustom allocator_type instance

Definition at line 616 of file darray.hpp.

◆ darray() [7/13]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::darray ( const darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem > & x,
const size_type _capacity,
const float growth_factor,
const allocator_type & alloc )
inlineexplicitconstexpr

Creates a new instance with custom initial storage capacity, copying all elements from the given darray.


Size will equal the given array.

Throws jau::IllegalArgumentException if _capacity < x.size().

Parameters
xthe given darray, all elements will be copied into the new instance.
_capacitycustom initial storage capacity
growth_factorcustom growth factor, see setGrowthFactor().
alloccustom allocator_type instance

Definition at line 636 of file darray.hpp.

◆ darray() [8/13]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::darray ( darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem > && x)
inlineconstexprnoexcept

Definition at line 674 of file darray.hpp.

◆ darray() [9/13]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::darray ( darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem > && x,
const float growth_factor,
const allocator_type & alloc )
inlineexplicitconstexprnoexcept

Definition at line 685 of file darray.hpp.

◆ darray() [10/13]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::darray ( const size_type _capacity,
const_iterator first,
const_iterator last,
const float growth_factor = DEFAULT_GROWTH_FACTOR,
const allocator_type & alloc = allocator_type() )
inlineexplicitconstexpr

Creates a new instance with custom initial storage capacity, copying all elements from the given const_iterator value_type range [first, last).


Size will equal the range [first, last), i.e. size_type(last-first).

Throws jau::IllegalArgumentException if _capacity < size_type(last - first).

Parameters
_capacitycustom initial storage capacity
firstconst_iterator to first element of value_type range [first, last)
lastconst_iterator to last element of value_type range [first, last)
growth_factorgiven growth factor, defaults to DEFAULT_GROWTH_FACTOR. See setGrowthFactor().
alloccustom allocator_type instance

Definition at line 735 of file darray.hpp.

◆ darray() [11/13]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
template<class InputIt>
jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::darray ( const size_type _capacity,
InputIt first,
InputIt last,
const float growth_factor = DEFAULT_GROWTH_FACTOR,
const allocator_type & alloc = allocator_type() )
inlineexplicitconstexpr

Creates a new instance with custom initial storage capacity, copying all elements from the given template input-iterator value_type range [first, last).


Size will equal the range [first, last), i.e. size_type(last-first).

Throws jau::IllegalArgumentException if _capacity < size_type(last - first).

Template Parameters
InputIttemplate input-iterator custom type
Parameters
_capacitycustom initial storage capacity
firsttemplate input-iterator to first element of value_type range [first, last)
lasttemplate input-iterator to last element of value_type range [first, last)
growth_factorgiven growth factor, defaults to DEFAULT_GROWTH_FACTOR. See setGrowthFactor().
alloccustom allocator_type instance

Definition at line 759 of file darray.hpp.

◆ darray() [12/13]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
template<class InputIt>
jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::darray ( InputIt first,
InputIt last,
const allocator_type & alloc = allocator_type() )
inlineconstexpr

Creates a new instance, copying all elements from the given template input-iterator value_type range [first, last).


Size will equal the range [first, last), i.e. size_type(last-first).

Template Parameters
InputIttemplate input-iterator custom type
Parameters
firsttemplate input-iterator to first element of value_type range [first, last)
lasttemplate input-iterator to last element of value_type range [first, last)
alloccustom allocator_type instance

Definition at line 778 of file darray.hpp.

◆ darray() [13/13]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::darray ( std::initializer_list< value_type > initlist,
const allocator_type & alloc = allocator_type() )
inlineconstexpr

Create a new instance from an initializer list.

Using the std::initializer_list requires to copy the given value_type objects into this darray.

To utilize more efficient move semantics, see push_back_list() and jau::make_darray().

Parameters
initlistinitializer_list.
allocallocator
See also
push_back_list()
jau::make_darray()

Definition at line 799 of file darray.hpp.

◆ ~darray()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::~darray ( )
inlinenoexcept

Definition at line 808 of file darray.hpp.

Member Function Documentation

◆ valueSignature()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
const jau::type_info & jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::valueSignature ( ) const
inlinenoexcept

Returns type signature of implementing class's stored value type.

Definition at line 203 of file darray.hpp.

Here is the caller graph for this function:

◆ classSignature()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
const jau::type_info & jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::classSignature ( ) const
inlinenoexcept

Returns type signature of implementing class.

Definition at line 208 of file darray.hpp.

◆ growthFactor()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
float jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::growthFactor ( ) const
inlineconstexprnoexcept

Returns growth factor, see setGrowthFactor() for semantics.

Definition at line 213 of file darray.hpp.

Here is the caller graph for this function:

◆ setGrowthFactor()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
void jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::setGrowthFactor ( float v)
inlineconstexprnoexcept

Sets the growth factor when size() == capacity() is reached for growing operations, defaults to golden ratio DEFAULT_GROWTH_FACTOR.

A growth factor of > 1 will grow storage by max(required_elements, growth_factor*capacity), to give room for further elements (efficiency).

A growth factor of 1 would only grow storage by required elements.

A growth factor of [0..1) disables growing the storage, i.e. pins storage, see pinned().

A growth factor of < 0 denotes storage is pinned() and shared with a parent instance, see slice(). Use has to ensure that the parent storage owner outlives this instance.

See also
pinned()
shared()
slice()

Definition at line 233 of file darray.hpp.

Here is the caller graph for this function:

◆ pinned()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::pinned ( ) const
inlineconstexpr

Returns true if growthFactor() < 1, otherwise false.

See setGrowthFactor().

Definition at line 235 of file darray.hpp.

Here is the caller graph for this function:

◆ shared()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::shared ( ) const
inlineconstexpr

Returns true if growthFactor() < 0, otherwise false.

See setGrowthFactor().

Definition at line 237 of file darray.hpp.

Here is the caller graph for this function:

◆ operator=() [1/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
darray & jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::operator= ( const darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem > & x)
inlineconstexpr

Like std::vector::operator=(&), assignment.

Definition at line 648 of file darray.hpp.

◆ operator=() [2/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
darray & jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::operator= ( darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem > && x)
inlineconstexprnoexcept

Like std::vector::operator=(&&), move.

Definition at line 699 of file darray.hpp.

◆ max_size()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
size_type jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::max_size ( ) const
inlineconstexprnoexcept

Returns std::numeric_limits<difference_type>::max() as the maximum array size.

We rely on the signed difference_type for pointer arithmetic, deducing ranges from iterator.

Definition at line 820 of file darray.hpp.

◆ begin() [1/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
iterator jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::begin ( )
inlineconstexprnoexcept

Definition at line 824 of file darray.hpp.

Here is the caller graph for this function:

◆ begin() [2/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
const_iterator jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::begin ( ) const
inlineconstexprnoexcept

Definition at line 825 of file darray.hpp.

◆ cbegin()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
const_iterator jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::cbegin ( ) const
inlineconstexprnoexcept

Definition at line 826 of file darray.hpp.

Here is the caller graph for this function:

◆ end() [1/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
iterator jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::end ( )
inlineconstexprnoexcept

Definition at line 828 of file darray.hpp.

Here is the caller graph for this function:

◆ end() [2/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
const_iterator jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::end ( ) const
inlineconstexprnoexcept

Definition at line 829 of file darray.hpp.

◆ cend()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
const_iterator jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::cend ( ) const
inlineconstexprnoexcept

Definition at line 830 of file darray.hpp.

Here is the caller graph for this function:

◆ position()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
size_type jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::position ( ) const
inlineconstexprnoexcept

Next relative read/write element index, with 0 <= position <= limit.

Definition at line 843 of file darray.hpp.

Here is the caller graph for this function:

◆ position_ptr() [1/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
pointer jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::position_ptr ( )
inlineconstexprnoexcept

Pointer to mutable next relative read/write element index, with 0 <= position <= limit.

Definition at line 845 of file darray.hpp.

Here is the caller graph for this function:

◆ position_ptr() [2/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
const_pointer jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::position_ptr ( ) const
inlineconstexprnoexcept

Pointer to immutable next relative read/write element index, with 0 <= position <= limit.

Definition at line 847 of file darray.hpp.

◆ setPosition()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
self_t & jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::setPosition ( size_type v)
inline

Sets position.

Throws exception if new position is > limit.

Definition at line 849 of file darray.hpp.

Here is the caller graph for this function:

◆ limit()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
size_type jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::limit ( ) const
inlineconstexprnoexcept

Read/write limit, one element beyond maximum index with limit <= size/end.

Definition at line 859 of file darray.hpp.

Here is the caller graph for this function:

◆ limit_ptr()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
const_pointer jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::limit_ptr ( ) const
inlineconstexprnoexcept

Pointer to immutable read/write limit, one element beyond maximum element with limit <= size/end.

Definition at line 861 of file darray.hpp.

Here is the caller graph for this function:

◆ setLimit()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
self_t & jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::setLimit ( size_type v)
inline

Sets new limit and adjusts position if new limit is below.

Throws exception if new limit is > size/end.

Definition at line 863 of file darray.hpp.

◆ flip()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
self_t & jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::flip ( )
inlineconstexprnoexcept

Sets limit to position and position to zero.

Definition at line 874 of file darray.hpp.

Here is the caller graph for this function:

◆ rewind()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
self_t & jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::rewind ( )
inlineconstexprnoexcept

Sets position to zero.

Definition at line 881 of file darray.hpp.

Here is the caller graph for this function:

◆ clearPosition()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
self_t & jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::clearPosition ( )
inlineconstexprnoexcept

Clears the relative position and limit w/o destructing elements nor mutating storage.

Sets position to zero and limit to size.

See also
position()
limit()
put()
get()

Definition at line 896 of file darray.hpp.

Here is the caller graph for this function:

◆ get()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
constexpr_cxx20 const_reference jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::get ( )
inline

Relative get() for single value reference, increasing position() by one.

Throws if position() >= limit().

Definition at line 907 of file darray.hpp.

Here is the caller graph for this function:

◆ put()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
constexpr_cxx20 self_t & jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::put ( const_reference v,
Bool grow = Bool::False )
inline

Relative put() for single value, increasing position().

Grows storage and/or moves limit if required and grow==True().

Throws if position() == limit().

Parameters
vvalue to be written
growset to Bool::True if allowing to grow, otherwise exception is thrown if position() == limit(). Defaults to Bool::False.
See also
setGrowthFactor()

Definition at line 925 of file darray.hpp.

Here is the caller graph for this function:

◆ putN()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
template<typename... Targs, std::enable_if_t< jau::is_all_same_v< Targs... > &&sizeof(Value_type) > = sizeof(jau::first_type<Targs...>) && std::is_assignable_v<value_type&, jau::first_type<Targs...>>, bool>
constexpr_cxx20 self_t & jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::putN ( Bool grow,
const Targs &... args )
inline

Relative put() for multiple value of an assignable type fitting into value_type, increasing position().

Grows storage and/or moves limit if required and grow==True().

Throws if position() + count > limit().

Template Parameters
Targsargument types, which must all be of the same type
Parameters
growset to Bool::True if allowing to grow, otherwise exception is thrown if position() == limit(). Defaults to Bool::False.
argsvalues to be written
See also
setGrowthFactor()

Definition at line 959 of file darray.hpp.

Here is the caller graph for this function:

◆ slice() [1/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
self_t jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::slice ( )
inline

Returns a sliced duplicate starting from this buffers' current position.

This buffer is pinned() afterwards, to not allow storage mutation.

Returned buffer is shared() and pinned() and shares the same storage of this buffer. Its position is zero and limit set to this buffers' remaining elements.

See also
pinned()
shared()
setGrowthFactor()

Definition at line 991 of file darray.hpp.

Here is the caller graph for this function:

◆ slice() [2/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
self_t jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::slice ( size_type idx,
size_type length )
inline

Returns a sliced duplicate starting from the given idx.

This buffer is pinned() afterwards, to not allow storage mutation.

Returned buffer is shared() and pinned() and shares the same storage of this buffer. Its position is zero and limit set to the given length.

Definition at line 1004 of file darray.hpp.

◆ duplicate()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
self_t jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::duplicate ( )
inline

Returns a duplicate with same position and limit.

This buffer is pinned() afterwards, to not allow storage mutation.

Returned buffer is shared() and pinned() and shares the same storage of this buffer. Its position and limit are same as with this buffer.

Definition at line 1019 of file darray.hpp.

Here is the caller graph for this function:

◆ remaining()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
size_type jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::remaining ( ) const
inlineconstexprnoexcept

Returns limit - position.

Definition at line 1025 of file darray.hpp.

Here is the caller graph for this function:

◆ hasRemaining()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::hasRemaining ( ) const
inlineconstexprnoexcept

Returns whether position < limit, i.e.

has remaining elements.

Definition at line 1027 of file darray.hpp.

Here is the caller graph for this function:

◆ get_allocator_ref()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
const allocator_type & jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::get_allocator_ref ( ) const
inlinenoexcept

Definition at line 1033 of file darray.hpp.

◆ get_allocator()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
allocator_type jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::get_allocator ( ) const
inlinenoexcept

Definition at line 1037 of file darray.hpp.

◆ capacity()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
size_type jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::capacity ( ) const
inlineconstexprnoexcept

Return the current capacity.

Definition at line 1044 of file darray.hpp.

Here is the caller graph for this function:

◆ get_grown_capacity()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
size_type jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::get_grown_capacity ( size_type add = 1) const
inlineconstexprnoexcept

Return the current capacity() multiplied by the growth factor, minimum is max(capacity()+add, 10).

Definition at line 1049 of file darray.hpp.

◆ empty()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::empty ( ) const
inlineconstexprnoexcept

Like std::vector::empty().

Definition at line 1058 of file darray.hpp.

◆ capacity_reached()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::capacity_reached ( ) const
inlineconstexprnoexcept

Returns true if capacity has been reached and the next push_back() will grow the storage and invalidates all iterators and references.

Definition at line 1064 of file darray.hpp.

◆ size()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
size_type jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::size ( ) const
inlineconstexprnoexcept

Like std::vector::size().

Definition at line 1069 of file darray.hpp.

Here is the caller graph for this function:

◆ front() [1/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
reference jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::front ( )
inlineconstexpr

Like std::vector::front(), mutable access.

Definition at line 1076 of file darray.hpp.

◆ front() [2/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
const_reference jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::front ( ) const
inlineconstexpr

Like std::vector::front(), immutable access.

Definition at line 1081 of file darray.hpp.

◆ back() [1/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
reference jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::back ( )
inlineconstexpr

Like std::vector::back(), mutable access.

Definition at line 1086 of file darray.hpp.

◆ back() [2/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
const_reference jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::back ( ) const
inlineconstexpr

Like std::vector::back(), immutable access.

Definition at line 1091 of file darray.hpp.

◆ data() [1/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
const_pointer jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::data ( ) const
inlineconstexprnoexcept

Like std::vector::data(), const immutable pointer.

Definition at line 1096 of file darray.hpp.

◆ data() [2/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
pointer jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::data ( )
inlineconstexprnoexcept

Like std::vector::data(), mutable pointer.

Definition at line 1101 of file darray.hpp.

◆ operator[]() [1/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
constexpr_cxx20 const_reference jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::operator[] ( size_type i) const
inlinenoexcept

Like std::vector::operator[](size_type), immutable reference.

Definition at line 1106 of file darray.hpp.

◆ operator[]() [2/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
constexpr_cxx20 reference jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::operator[] ( size_type i)
inlinenoexcept

Like std::vector::operator[](size_type), mutable reference.

Definition at line 1113 of file darray.hpp.

◆ at() [1/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
constexpr_cxx20 const_reference jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::at ( size_type i) const
inline

Like std::vector::at(size_type), immutable reference.

Definition at line 1120 of file darray.hpp.

Here is the caller graph for this function:

◆ at() [2/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
constexpr_cxx20 reference jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::at ( size_type i)
inline

Like std::vector::at(size_type), mutable reference.

Definition at line 1130 of file darray.hpp.

◆ reserve()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
self_t & jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::reserve ( size_type new_capacity)
inlineconstexpr

Like std::vector::reserve(), increases this instance's capacity to new_capacity.

Only creates a new storage and invalidates iterators if new_capacity is greater than the current jau::darray::capacity().

Definition at line 1146 of file darray.hpp.

◆ resize() [1/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
self_t & jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::resize ( size_type new_size,
const value_type & val )
inlineconstexpr

Like std::vector::resize(size_type, const value_type&)

Definition at line 1156 of file darray.hpp.

Here is the caller graph for this function:

◆ resize() [2/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
self_t & jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::resize ( size_type new_size)
inlineconstexpr

Like std::vector::resize(size_type)

Definition at line 1177 of file darray.hpp.

Here is the caller graph for this function:

◆ shrink_to_fit()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
self_t & jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::shrink_to_fit ( )
inlineconstexpr

Like std::vector::shrink_to_fit(), but ensured constexpr.

If capacity() > size(), reallocate storage to size().

Definition at line 1184 of file darray.hpp.

◆ assign() [1/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
template<class InputIt>
void jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::assign ( InputIt first,
InputIt last )
inlineconstexpr

Like std::vector::assign()

Template Parameters
InputItforeign input-iterator to range of value_type [first, last)
Parameters
firstfirst foreign input-iterator to range of value_type [first, last)
lastlast foreign input-iterator to range of value_type [first, last)

Definition at line 1199 of file darray.hpp.

◆ assign() [2/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
void jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::assign ( const_iterator first,
const_iterator last )
inlineconstexpr

Like std::vector::assign(), but non-template overload using const_iterator.

Parameters
firstfirst const_iterator to range of value_type [first, last)
lastlast const_iterator to range of value_type [first, last)

Definition at line 1220 of file darray.hpp.

◆ clear() [1/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
self_t & jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::clear ( )
inlineconstexprnoexcept

Like std::vector::clear(), calls destructor on all elements and leaving capacity unchanged.

Sets position and limit to zero.

Use clear(true) or subsequently shrink_to_fit() to release capacity (storage).

See also
clear(bool)
shrink_to_fit()

Definition at line 1247 of file darray.hpp.

Here is the caller graph for this function:

◆ clear() [2/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
self_t & jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::clear ( bool releaseMem)
inlineconstexprnoexcept

Like std::vector::clear(), calls destructor on all elements.

Sets position and limit to zero.

If releaseMem is true, releases capacity (memory), otherwise leaves capacity unchanged and sets position to zero, limit to capacity.

See also
clear()

Definition at line 1266 of file darray.hpp.

◆ swap()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
void jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::swap ( darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem > & x)
inlineconstexprnoexcept

Like std::vector::swap().

Definition at line 1284 of file darray.hpp.

◆ pop_back()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
void jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::pop_back ( )
inlineconstexprnoexcept

Like std::vector::pop_back().

Updates end, limit and adjusts position if > new limit.

Definition at line 1303 of file darray.hpp.

◆ erase() [1/4]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
iterator jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::erase ( const_iterator cpos)
inlineconstexpr

Like std::vector::erase(), removes the elements at pos.

Updates end, limit and adjusts position if > > cpos

Returns
iterator following the last removed element.

Definition at line 1318 of file darray.hpp.

Here is the caller graph for this function:

◆ erase() [2/4]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
iterator jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::erase ( const_iterator cfirst,
const_iterator clast )
inlineconstexpr

Like std::vector::erase(), removes the elements in the range [first, last).

Updates end, limit and adjusts position if > cfirst.

Returns
iterator following the last removed element.

Definition at line 1339 of file darray.hpp.

◆ erase() [3/4]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
iterator jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::erase ( const size_type pos_idx)
inlineconstexpr

Similar to std::vector::erase() using an index, removes the elements at pos_idx.

Updates end, limit and adjusts position if > new limit.

Returns
iterator following the last removed element.

Definition at line 1362 of file darray.hpp.

◆ erase() [4/4]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
iterator jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::erase ( const size_type first_idx,
const size_type last_idx )
inlineconstexpr

Similar to std::vector::erase() using indices, removes the elements in the range [first_idx, last_idx).

Updates end, limit and adjusts position if > new limit.

Returns
iterator following the last removed element.

Definition at line 1373 of file darray.hpp.

◆ insert() [1/4]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
iterator jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::insert ( const_iterator pos,
const value_type & x )
inlineconstexpr

Like std::vector::insert(), copy.

Inserts the element before pos and moves all elements from there to the right beforehand.

size/end and limit will be increased by one.

Parameters
positerator before which the content will be inserted. pos may be the end() iterator
xelement value to insert

Definition at line 1388 of file darray.hpp.

Here is the caller graph for this function:

◆ insert() [2/4]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
iterator jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::insert ( const size_type pos_idx,
const value_type & x )
inlineconstexpr

Similar to std::vector::insert() using an index, copy.

Parameters
pos_idxindex before which the content will be inserted. index may be the end size() index
xelement value to insert
See also
insert()

Definition at line 1414 of file darray.hpp.

◆ insert() [3/4]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
iterator jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::insert ( const_iterator pos,
value_type && x )
inlineconstexpr

Like std::vector::insert(), move.

Inserts the element before the given position and moves all elements from there to the right beforehand.

size/end and limit will be increased by one.

Parameters
positerator before which the content will be inserted. pos may be the end() iterator
xelement value to be moved into

Definition at line 1429 of file darray.hpp.

◆ emplace()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
template<typename... Args>
iterator jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::emplace ( const_iterator pos,
Args &&... args )
inlineconstexpr

Like std::vector::emplace(), construct a new element in place.

Constructs the element before the given position using placement new and moves all elements from there to the right beforehand.

size/end and limit will be increased by one.

Parameters
positerator before which the content will be inserted. pos may be the end() iterator
argsarguments to forward to the constructor of the element

Definition at line 1461 of file darray.hpp.

◆ insert() [4/4]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
template<class InputIt>
iterator jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::insert ( const_iterator pos,
InputIt first,
InputIt last )
inlineconstexpr

Like std::vector::insert(), inserting the value_type range [first, last).

size/end and limit will be increased by inserted elements.

Template Parameters
InputItforeign input-iterator to range of value_type [first, last)
Parameters
positerator before which the content will be inserted. pos may be the end() iterator
firstfirst foreign input-iterator to range of value_type [first, last)
lastlast foreign input-iterator to range of value_type [first, last)
Returns
Iterator pointing to the first element inserted, or pos if first==last.

Definition at line 1493 of file darray.hpp.

◆ push_back() [1/3]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
void jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::push_back ( const value_type & x)
inlineconstexpr

Like std::vector::push_back(), copy.

size/end and limit will be increased by one, position set to limit/end.

Parameters
xthe value to be added at the tail.

Definition at line 1522 of file darray.hpp.

Here is the caller graph for this function:

◆ push_back() [2/3]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
void jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::push_back ( value_type && x)
inlineconstexpr

Like std::vector::push_back(), move.

size/end and limit will be increased by one, position set to limit/end.

Parameters
xthe value to be added at the tail.

Definition at line 1538 of file darray.hpp.

◆ push_front() [1/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
void jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::push_front ( const value_type & x)
inlineconstexpr

Like std::vector::push_front(), copy.

size/end and limit will be increased by one.

Parameters
xthe value to be added at the front.

Definition at line 1554 of file darray.hpp.

◆ push_front() [2/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
void jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::push_front ( value_type && x)
inlineconstexpr

Like std::vector::push_front(), move.

size/end and limit will be increased by one.

Parameters
xthe value to be added at the front.

Definition at line 1565 of file darray.hpp.

◆ emplace_back()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
template<typename... Args>
reference jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::emplace_back ( Args &&... args)
inlineconstexpr

Like std::vector::emplace_back(), construct a new element in place at the end().

Constructs the element at the end() using placement new.

size/end and limit will be increased by one, position set to limit/end.

Parameters
argsarguments to forward to the constructor of the element

Definition at line 1579 of file darray.hpp.

Here is the caller graph for this function:

◆ push_back() [3/3]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
template<class InputIt>
void jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::push_back ( InputIt first,
InputIt last )
inlineconstexpr

Like std::vector::push_back(), but appends the value_type range [first, last).

size/end and limit will be increased by inserted elements, position set to limit/end.

Template Parameters
InputItforeign input-iterator to range of value_type [first, last)
Parameters
firstfirst foreign input-iterator to range of value_type [first, last)
lastlast foreign input-iterator to range of value_type [first, last)

Definition at line 1600 of file darray.hpp.

◆ push_back_list() [1/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
template<typename... Args>
void jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::push_back_list ( const Args &... args)
inlineconstexpr

Like push_back(), but for more multiple const r-value to copy.

size/end and limit will be increased by inserted elements, position set to limit/end.

Template Parameters
Args
Parameters
argsr-value references to copy into this storage

Definition at line 1621 of file darray.hpp.

Here is the caller graph for this function:

◆ push_back_list() [2/2]

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
template<typename... Args>
void jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::push_back_list ( Args &&... args)
inlineconstexpr

Like push_back(), but for more multiple r-value references to move.

size/end and limit will be increased by inserted elements, position set to limit/end.

Template Parameters
Args
Parameters
argsr-value references to move into this storage
See also
jau::make_darray()

Definition at line 1648 of file darray.hpp.

◆ push_back_unique()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::push_back_unique ( const value_type & x,
equal_comparator comparator )
inlineconstexpr

Like std::vector::push_back(), but only if the newly added element does not yet exist.

Examples

    static jau::darray<Thing>::equal_comparator thingEqComparator =
                 [](const Thing &a, const Thing &b) -> bool { return a == b; };
    ...
    jau::darray<Thing> list;

    bool added = list.push_back_unique(new_element, thingEqComparator);
    ...
    darray<std::shared_ptr<Thing>> listOfRefs;
    bool added = listOfRefs.push_back_unique(new_element,
                   [](const std::shared_ptr<Thing> &a, const std::shared_ptr<Thing> &b) -> bool { return *a == *b; });
Parameters
xthe value to be added at the tail, if not existing yet.
comparatorthe equal comparator to return true if both given elements are equal
Returns
true if the element has been uniquely added, otherwise false
See also
push_back()

Definition at line 1695 of file darray.hpp.

◆ erase_matching()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
size_type jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::erase_matching ( const value_type & x,
const bool all_matching,
equal_comparator comparator )
inlineconstexpr

Erase either the first matching element or all matching elements using erase().

Examples

    darray<Thing> list;
    int count = list.erase_matching(element, true,
                   [](const Thing &a, const Thing &b) -> bool { return a == b; });
    ...
    static jau::darray<Thing>::equal_comparator thingRefEqComparator =
                 [](const std::shared_ptr<Thing> &a, const std::shared_ptr<Thing> &b) -> bool { return *a == *b; };
    ...
    darray<std::shared_ptr<Thing>> listOfRefs;
    int count = listOfRefs.erase_matching(element, false, thingRefEqComparator);
Parameters
xthe value to be added at the tail, if not existing yet.
all_matchingif true, erase all matching elements, otherwise only the first matching element.
comparatorthe equal comparator to return true if both given elements are equal
Returns
number of erased elements
See also
erase()

Definition at line 1729 of file darray.hpp.

◆ erase_if()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
template<class UnaryPredicate>
size_type jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::erase_if ( const bool all_matching,
UnaryPredicate p )
inlineconstexpr

Erase either the first matching element or all matching elements.

Examples

    darray<Thing> list;
    int count = list.erase_if(true,
                   [&element](const Thing &a) -> bool { return a == element; });
Parameters
all_matchingif true, erase all matching elements, otherwise only the first matching element.
pthe unary predicate test to return true if given elements shall be erased
Returns
number of erased elements

Definition at line 1758 of file darray.hpp.

◆ toString()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
std::string jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::toString ( ) const
inlinenoexcept

Definition at line 1772 of file darray.hpp.

Here is the caller graph for this function:

◆ getInfo()

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
std::string jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::getInfo ( ) const
inlinenoexcept

Definition at line 1783 of file darray.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ DEFAULT_GROWTH_FACTOR

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
const float jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::DEFAULT_GROWTH_FACTOR = std::numbers::phi_v<float>
staticconstexpr

Default growth factor using the golden ratio 1.618.

See setGrowthFactor().

Definition at line 156 of file darray.hpp.

◆ uses_memmove

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
const bool jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::uses_memmove = use_memmove
staticconstexpr

Definition at line 158 of file darray.hpp.

◆ uses_secmem

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
const bool jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::uses_secmem = use_secmem
staticconstexpr

Definition at line 159 of file darray.hpp.

◆ uses_realloc

template<typename Value_type, typename Size_type = jau::nsize_t, typename Alloc_type = jau::callocator<Value_type>, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
const bool jau::darray< Value_type, Size_type, Alloc_type, use_memmove, use_secmem >::uses_realloc = use_memmove && std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>
staticconstexpr

Definition at line 160 of file darray.hpp.


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