Direct-BT  2.3.1
Direct-BT - Direct Bluetooth Programming.
Public Types | Public Member Functions | Static Public Attributes | List of all members
jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem > Class Template Reference

Implementation of a dynamic linear array storage, aka vector. More...

#include <darray.hpp>

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

Public Types

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

Public Member Functions

constexpr darray () noexcept
 Default constructor, giving zero capacity and zero memory footprint. More...
 
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. More...
 
constexpr darray (const darray &x)
 Creates a new instance, copying all elements from the given darray. More...
 
constexpr darray (const darray &x, const float growth_factor, const allocator_type &alloc)
 Creates a new instance, copying all elements from the given darray. More...
 
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. More...
 
constexpr darrayoperator= (const darray &x)
 Like std::vector::operator=(&), assignment. More...
 
constexpr darray (darray &&x) noexcept
 
constexpr darray (darray &&x, const float growth_factor, const allocator_type &alloc) noexcept
 
constexpr darrayoperator= (darray &&x) noexcept
 Like std::vector::operator=(&&), move. More...
 
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). More...
 
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). More...
 
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). More...
 
constexpr darray (std::initializer_list< value_type > initlist, const allocator_type &alloc=allocator_type())
 Create a new instance from an initializer list. More...
 
 ~darray () noexcept
 
constexpr size_type max_size () const noexcept
 Returns std::numeric_limits<difference_type>::max() as the maximum array size. More...
 
constexpr iterator begin () noexcept
 
constexpr const_iterator begin () const noexcept
 
constexpr const_iterator cbegin () const noexcept
 
constexpr iterator end () noexcept
 
constexpr const_iterator end () const noexcept
 
constexpr const_iterator cend () const noexcept
 
const allocator_typeget_allocator_ref () const noexcept
 
allocator_type get_allocator () const noexcept
 
constexpr float growth_factor () const noexcept
 
constexpr size_type capacity () const noexcept
 Return the current capacity. More...
 
constexpr size_type get_grown_capacity () const noexcept
 Return the current capacity() multiplied by the growth factor, minimum is max(capacity()+1, 10). More...
 
constexpr bool empty () const noexcept
 Like std::vector::empty(). More...
 
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. More...
 
constexpr size_type size () const noexcept
 Like std::vector::size(). More...
 
constexpr reference front ()
 Like std::vector::front(), mutable access. More...
 
constexpr const_reference front () const
 Like std::vector::front(), immutable access. More...
 
constexpr reference back ()
 Like std::vector::back(), mutable access. More...
 
constexpr const_reference back () const
 Like std::vector::back(), immutable access. More...
 
constexpr const_pointer data () const noexcept
 Like std::vector::data(), const immutable pointer. More...
 
constexpr pointer data () noexcept
 Like std::vector::data(), mutable pointer. More...
 
const_reference operator[] (size_type i) const noexcept
 Like std::vector::operator[](size_type), immutable reference. More...
 
reference operator[] (size_type i) noexcept
 Like std::vector::operator[](size_type), mutable reference. More...
 
const_reference at (size_type i) const
 Like std::vector::at(size_type), immutable reference. More...
 
reference at (size_type i)
 Like std::vector::at(size_type), mutable reference. More...
 
void reserve (size_type new_capacity)
 Like std::vector::reserve(), increases this instance's capacity to new_capacity. More...
 
template<class InputIt >
constexpr void assign (InputIt first, InputIt last)
 Like std::vector::assign() More...
 
constexpr void assign (const_iterator first, const_iterator last)
 Like std::vector::assign(), but non-template overload using const_iterator. More...
 
constexpr void clear () noexcept
 Like std::vector::clear(), but ending with zero capacity. More...
 
constexpr void swap (darray &x) noexcept
 Like std::vector::swap(). More...
 
constexpr void pop_back () noexcept
 Like std::vector::pop_back(). More...
 
constexpr iterator erase (const_iterator pos)
 Like std::vector::erase(), removes the elements at pos. More...
 
constexpr iterator erase (iterator first, const_iterator last)
 Like std::vector::erase(), removes the elements in the range [first, last). More...
 
constexpr iterator insert (const_iterator pos, const value_type &x)
 Like std::vector::insert(), copy. More...
 
constexpr iterator insert (const_iterator pos, value_type &&x)
 Like std::vector::insert(), move. More...
 
template<typename... Args>
constexpr iterator emplace (const_iterator pos, Args &&... args)
 Like std::vector::emplace(), construct a new element in place. More...
 
template<class InputIt >
constexpr iterator insert (const_iterator pos, InputIt first, InputIt last)
 Like std::vector::insert(), inserting the value_type range [first, last). More...
 
constexpr void push_back (const value_type &x)
 Like std::vector::push_back(), copy. More...
 
constexpr void push_back (value_type &&x)
 Like std::vector::push_back(), move. More...
 
template<typename... Args>
constexpr reference emplace_back (Args &&... args)
 Like std::vector::emplace_back(), construct a new element in place at the end(). More...
 
template<class InputIt >
constexpr void push_back (InputIt first, InputIt last)
 Like std::vector::push_back(), but appends the value_type range [first, last). More...
 
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. More...
 
constexpr int erase_matching (const value_type &x, const bool all_matching, equal_comparator comparator)
 Erase either the first matching element or all matching elements. More...
 
constexpr_cxx20 std::string toString () const noexcept
 
constexpr_cxx20 std::string get_info () const noexcept
 

Static Public Attributes

constexpr static const float DEFAULT_GROWTH_FACTOR = 1.618f
 Default growth factor using the golden ratio 1.618. More...
 
constexpr static const bool uses_memmove = use_memmove
 
constexpr static const bool uses_realloc = use_realloc
 
constexpr static const bool uses_secmem = sec_mem
 

Detailed Description

template<typename Value_type, typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
class jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >

Implementation of a dynamic linear array storage, aka vector.


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

Non-Type Template Parameter use_memmove can be overriden by the user and has its default value std::is_trivially_copyable_v<Value_type>.
The default value has been chosen with care, see C++ Standard section 6.9 Types trivially copyable.
However, one can set use_memmove to true even without the value_type being trivially copyable, as long certain memory side-effects can be excluded (TBD).

Examples
dbt_scanner10.cpp, test_cow_darray_01.cpp, and test_cow_iterator_01.cpp.

Definition at line 101 of file darray.hpp.

Member Typedef Documentation

◆ allocator_type

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
typedef Alloc_type jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::allocator_type

Definition at line 124 of file darray.hpp.

◆ const_iterator

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
typedef const value_type* jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::const_iterator

Definition at line 119 of file darray.hpp.

◆ const_pointer

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
typedef const value_type* jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::const_pointer

Definition at line 115 of file darray.hpp.

◆ const_reference

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
typedef const value_type& jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::const_reference

Definition at line 117 of file darray.hpp.

◆ darray_tag

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
typedef bool jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::darray_tag

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

Definition at line 127 of file darray.hpp.

◆ difference_type

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
typedef std::make_signed<size_type>::type jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::difference_type

Definition at line 121 of file darray.hpp.

◆ equal_comparator

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
typedef bool(* jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::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 1055 of file darray.hpp.

◆ iterator

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
typedef value_type* jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::iterator

Definition at line 118 of file darray.hpp.

◆ pointer

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
typedef value_type* jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::pointer

Definition at line 114 of file darray.hpp.

◆ reference

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
typedef value_type& jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::reference

Definition at line 116 of file darray.hpp.

◆ size_type

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
typedef Size_type jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::size_type

Definition at line 120 of file darray.hpp.

◆ value_type

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
typedef Value_type jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::value_type

Definition at line 113 of file darray.hpp.

Constructor & Destructor Documentation

◆ darray() [1/11]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::darray ( )
inlineconstexprnoexcept

Default constructor, giving zero capacity and zero memory footprint.

Definition at line 378 of file darray.hpp.

◆ darray() [2/11]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::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
allocgiven allocator_type

Definition at line 390 of file darray.hpp.

◆ darray() [3/11]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::darray ( const darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem > &  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.

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

Definition at line 403 of file darray.hpp.

◆ darray() [4/11]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::darray ( const darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem > &  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.

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

Definition at line 417 of file darray.hpp.

◆ darray() [5/11]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::darray ( const darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem > &  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
alloccustom allocator_type instance

Definition at line 435 of file darray.hpp.

◆ darray() [6/11]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::darray ( darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem > &&  x)
inlineconstexprnoexcept

Definition at line 469 of file darray.hpp.

◆ darray() [7/11]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::darray ( darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem > &&  x,
const float  growth_factor,
const allocator_type alloc 
)
inlineexplicitconstexprnoexcept

Definition at line 479 of file darray.hpp.

◆ darray() [8/11]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::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_factorcustom growth factor
alloccustom allocator_type instance

Definition at line 533 of file darray.hpp.

◆ darray() [9/11]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
template<class InputIt >
constexpr jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::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_factorcustom growth factor
alloccustom allocator_type instance

Definition at line 555 of file darray.hpp.

◆ darray() [10/11]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
template<class InputIt >
constexpr jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::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 572 of file darray.hpp.

◆ darray() [11/11]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::darray ( std::initializer_list< value_type initlist,
const allocator_type alloc = allocator_type() 
)
inlineconstexpr

Create a new instance from an initializer list.

Parameters
initlistinitializer_list.
allocallocator

Definition at line 584 of file darray.hpp.

◆ ~darray()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::~darray ( )
inlinenoexcept

Definition at line 590 of file darray.hpp.

Member Function Documentation

◆ assign() [1/2]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr void jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::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 778 of file darray.hpp.

◆ assign() [2/2]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
template<class InputIt >
constexpr void jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::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 759 of file darray.hpp.

◆ at() [1/2]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
reference jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::at ( size_type  i)
inline

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

Definition at line 729 of file darray.hpp.

◆ at() [2/2]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
const_reference jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::at ( size_type  i) const
inline

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

Definition at line 719 of file darray.hpp.

Here is the caller graph for this function:

◆ back() [1/2]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr reference jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::back ( )
inlineconstexpr

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

Definition at line 685 of file darray.hpp.

◆ back() [2/2]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr const_reference jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::back ( ) const
inlineconstexpr

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

Definition at line 690 of file darray.hpp.

◆ begin() [1/2]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr const_iterator jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::begin ( ) const
inlineconstexprnoexcept

Definition at line 608 of file darray.hpp.

◆ begin() [2/2]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr iterator jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::begin ( )
inlineconstexprnoexcept

Definition at line 606 of file darray.hpp.

Here is the caller graph for this function:

◆ capacity()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr size_type jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::capacity ( ) const
inlineconstexprnoexcept

Return the current capacity.

Definition at line 643 of file darray.hpp.

Here is the caller graph for this function:

◆ capacity_reached()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr bool jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::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 663 of file darray.hpp.

◆ cbegin()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr const_iterator jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::cbegin ( ) const
inlineconstexprnoexcept

Definition at line 610 of file darray.hpp.

Here is the caller graph for this function:

◆ cend()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr const_iterator jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::cend ( ) const
inlineconstexprnoexcept

Definition at line 616 of file darray.hpp.

Here is the caller graph for this function:

◆ clear()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr void jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::clear ( )
inlineconstexprnoexcept

Like std::vector::clear(), but ending with zero capacity.

Definition at line 796 of file darray.hpp.

Here is the caller graph for this function:

◆ data() [1/2]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr const_pointer jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::data ( ) const
inlineconstexprnoexcept

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

Definition at line 695 of file darray.hpp.

◆ data() [2/2]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr pointer jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::data ( )
inlineconstexprnoexcept

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

Definition at line 700 of file darray.hpp.

◆ emplace()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
template<typename... Args>
constexpr iterator jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::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 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 937 of file darray.hpp.

◆ emplace_back()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
template<typename... Args>
constexpr reference jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::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 will be increased by one.

Parameters
argsarguments to forward to the constructor of the element

Definition at line 1022 of file darray.hpp.

◆ empty()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr bool jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::empty ( ) const
inlineconstexprnoexcept

Like std::vector::empty().

Definition at line 657 of file darray.hpp.

◆ end() [1/2]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr const_iterator jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::end ( ) const
inlineconstexprnoexcept

Definition at line 614 of file darray.hpp.

◆ end() [2/2]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr iterator jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::end ( )
inlineconstexprnoexcept

Definition at line 612 of file darray.hpp.

Here is the caller graph for this function:

◆ erase() [1/2]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr iterator jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::erase ( const_iterator  pos)
inlineconstexpr

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

Returns
iterator following the last removed element.

Definition at line 832 of file darray.hpp.

Here is the caller graph for this function:

◆ erase() [2/2]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr iterator jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::erase ( iterator  first,
const_iterator  last 
)
inlineconstexpr

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

Returns
iterator following the last removed element.

Definition at line 848 of file darray.hpp.

◆ erase_matching()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr int jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::erase_matching ( const value_type x,
const bool  all_matching,
equal_comparator  comparator 
)
inlineconstexpr

Erase either the first matching element or all matching elements.

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

Definition at line 1111 of file darray.hpp.

◆ front() [1/2]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr reference jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::front ( )
inlineconstexpr

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

Definition at line 675 of file darray.hpp.

◆ front() [2/2]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr const_reference jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::front ( ) const
inlineconstexpr

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

Definition at line 680 of file darray.hpp.

◆ get_allocator()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
allocator_type jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::get_allocator ( ) const
inlinenoexcept

Definition at line 632 of file darray.hpp.

◆ get_allocator_ref()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
const allocator_type& jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::get_allocator_ref ( ) const
inlinenoexcept

Definition at line 628 of file darray.hpp.

◆ get_grown_capacity()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr size_type jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::get_grown_capacity ( ) const
inlineconstexprnoexcept

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

Definition at line 648 of file darray.hpp.

◆ get_info()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr_cxx20 std::string jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::get_info ( ) const
inlinenoexcept

Definition at line 1136 of file darray.hpp.

Here is the caller graph for this function:

◆ growth_factor()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr float jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::growth_factor ( ) const
inlineconstexprnoexcept

Definition at line 636 of file darray.hpp.

◆ insert() [1/3]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr iterator jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::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 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 872 of file darray.hpp.

◆ insert() [2/3]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
template<class InputIt >
constexpr iterator jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::insert ( const_iterator  pos,
InputIt  first,
InputIt  last 
)
inlineconstexpr

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

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 966 of file darray.hpp.

◆ insert() [3/3]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr iterator jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::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 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 904 of file darray.hpp.

◆ max_size()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr size_type jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::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 602 of file darray.hpp.

◆ operator=() [1/2]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr darray& jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::operator= ( const darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem > &  x)
inlineconstexpr

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

Definition at line 445 of file darray.hpp.

◆ operator=() [2/2]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr darray& jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::operator= ( darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem > &&  x)
inlineconstexprnoexcept

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

Definition at line 499 of file darray.hpp.

◆ operator[]() [1/2]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
const_reference jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::operator[] ( size_type  i) const
inlinenoexcept

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

Definition at line 705 of file darray.hpp.

◆ operator[]() [2/2]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
reference jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::operator[] ( size_type  i)
inlinenoexcept

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

Definition at line 712 of file darray.hpp.

◆ pop_back()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr void jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::pop_back ( )
inlineconstexprnoexcept

Like std::vector::pop_back().

Definition at line 822 of file darray.hpp.

◆ push_back() [1/3]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr void jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::push_back ( const value_type x)
inlineconstexpr

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

Parameters
xthe value to be added at the tail.

Definition at line 991 of file darray.hpp.

Here is the caller graph for this function:

◆ push_back() [2/3]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
template<class InputIt >
constexpr void jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::push_back ( InputIt  first,
InputIt  last 
)
inlineconstexpr

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

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 1039 of file darray.hpp.

◆ push_back() [3/3]

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr void jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::push_back ( value_type &&  x)
inlineconstexpr

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

Parameters
xthe value to be added at the tail.

Definition at line 1003 of file darray.hpp.

◆ push_back_unique()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr bool jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::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

Definition at line 1078 of file darray.hpp.

◆ reserve()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
void jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::reserve ( size_type  new_capacity)
inline

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 745 of file darray.hpp.

Here is the caller graph for this function:

◆ size()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr size_type jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::size ( ) const
inlineconstexprnoexcept

Like std::vector::size().

Definition at line 668 of file darray.hpp.

Here is the caller graph for this function:

◆ swap()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr void jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::swap ( darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem > &  x)
inlineconstexprnoexcept

Like std::vector::swap().

Definition at line 807 of file darray.hpp.

◆ toString()

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr_cxx20 std::string jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::toString ( ) const
inlinenoexcept

Definition at line 1125 of file darray.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ DEFAULT_GROWTH_FACTOR

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr static const float jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::DEFAULT_GROWTH_FACTOR = 1.618f
staticconstexpr

Default growth factor using the golden ratio 1.618.

Definition at line 105 of file darray.hpp.

◆ uses_memmove

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr static const bool jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::uses_memmove = use_memmove
staticconstexpr

Definition at line 107 of file darray.hpp.

◆ uses_realloc

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr static const bool jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::uses_realloc = use_realloc
staticconstexpr

Definition at line 108 of file darray.hpp.

◆ uses_secmem

template<typename Value_type , typename Alloc_type = jau::callocator<Value_type>, typename Size_type = jau::nsize_t, bool use_memmove = std::is_trivially_copyable_v<Value_type>, bool use_realloc = std::is_base_of_v<jau::callocator<Value_type>, Alloc_type>, bool sec_mem = false>
constexpr static const bool jau::darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::uses_secmem = sec_mem
staticconstexpr

Definition at line 109 of file darray.hpp.


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