Direct-BT
2.3.1
Direct-BT - Direct Bluetooth Programming.
|
Implementation of a Copy-On-Write (CoW) using jau::darray as the underlying storage, exposing lock-free read operations using SC-DRF atomic synchronization. More...
#include <cow_darray.hpp>
Public Types | |
typedef Value_type | value_type |
typedef value_type * | pointer |
typedef const value_type * | const_pointer |
typedef value_type & | reference |
typedef const value_type & | const_reference |
typedef Size_type | size_type |
typedef std::make_signed< size_type >::type | difference_type |
typedef Alloc_type | allocator_type |
typedef darray< value_type, allocator_type, size_type, use_memmove, use_realloc, sec_mem > | storage_t |
typedef std::shared_ptr< storage_t > | storage_ref_t |
typedef bool | darray_tag |
Used to determine whether this type is a darray or has a darray, see ::is_darray_type<T> More... | |
typedef cow_darray< value_type, allocator_type, size_type, use_memmove, use_realloc, sec_mem > | cow_container_t |
typedef cow_ro_iterator< storage_t, storage_ref_t, cow_container_t > | const_iterator |
Immutable, read-only const_iterator, lock-free, holding the current shared store reference until destruction. More... | |
typedef cow_rw_iterator< storage_t, storage_ref_t, cow_container_t > | iterator |
Mutable, read-write iterator, holding the write-lock and a store copy until destruction. 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 | cow_darray () noexcept |
Default constructor, giving almost zero capacity and zero memory footprint, but the shared empty jau::darray. More... | |
constexpr | cow_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 | cow_darray (const storage_t &x) |
constexpr | cow_darray (const storage_t &x, const float growth_factor, const allocator_type &alloc) |
cow_darray & | operator= (const storage_t &x) |
Like std::vector::operator=(&), assignment, but copying from the underling jau::darray. More... | |
constexpr | cow_darray (storage_t &&x) noexcept |
constexpr | cow_darray (storage_t &&x, const float growth_factor, const allocator_type &alloc) noexcept |
cow_darray & | operator= (storage_t &&x) |
Like std::vector::operator=(&&), move, but taking the underling jau::darray. More... | |
constexpr_atomic | cow_darray (const cow_darray &x) |
Creates a new instance, copying all elements from the given array. More... | |
constexpr_atomic | cow_darray (const cow_darray &x, const float growth_factor, const allocator_type &alloc) |
Creates a new instance, copying all elements from the given array. More... | |
constexpr_atomic | cow_darray (const cow_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 array. More... | |
constexpr_atomic cow_darray & | operator= (const cow_darray &x) |
Like std::vector::operator=(&), assignment. More... | |
constexpr_atomic | cow_darray (cow_darray &&x) noexcept |
constexpr_atomic cow_darray & | operator= (cow_darray &&x) noexcept |
Like std::vector::operator=(&&), move. More... | |
constexpr | cow_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 | cow_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 | cow_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 | cow_darray (std::initializer_list< value_type > initlist, const allocator_type &alloc=allocator_type()) |
Create a new instance from an initializer list. More... | |
~cow_darray () noexcept | |
constexpr size_type | max_size () const noexcept |
Returns std::numeric_limits<difference_type>::max() as the maximum array size. More... | |
constexpr std::recursive_mutex & | get_write_mutex () noexcept |
Returns this instances' recursive write mutex, allowing user to implement more complex mutable write operations. More... | |
constexpr_atomic storage_ref_t | copy_store () |
Returns a new shared_ptr copy of the underlying store, i.e. More... | |
constexpr_atomic void | set_store (storage_ref_t &&new_store_ref) noexcept |
Replace the current store with the given instance, potentially acquired via jau::cow_darray::copy_store() and mutated while holding the jau::cow_darray::get_write_mutex() lock. More... | |
constexpr_atomic storage_ref_t | snapshot () const noexcept |
Returns the current snapshot of the underlying shared storage by reference. More... | |
constexpr const_iterator | cbegin () const noexcept |
Returns an jau::cow_ro_iterator to the first element of this CoW storage. More... | |
constexpr iterator | begin () |
Returns an jau::cow_rw_iterator to the first element of this CoW storage. More... | |
const allocator_type & | get_allocator_ref () const noexcept |
allocator_type | get_allocator () const noexcept |
constexpr_atomic float | growth_factor () const noexcept |
Returns the growth factor. More... | |
constexpr_atomic size_type | capacity () const noexcept |
Like std::vector::empty(). More... | |
constexpr_atomic bool | empty () const noexcept |
Like std::vector::empty(). More... | |
constexpr_atomic size_type | size () const noexcept |
Like std::vector::size(). More... | |
void | reserve (size_type new_capacity) |
Like std::vector::reserve(), increases this instance's capacity to new_capacity . More... | |
constexpr_atomic void | clear () noexcept |
Like std::vector::clear(), but ending with zero capacity. More... | |
constexpr_atomic void | swap (cow_darray &x) noexcept |
Like std::vector::swap(). More... | |
constexpr_atomic void | pop_back () noexcept |
Like std::vector::pop_back(). More... | |
constexpr_atomic void | push_back (const value_type &x) |
Like std::vector::push_back(), copy. More... | |
constexpr_atomic void | push_back (value_type &&x) |
Like std::vector::push_back(), move. More... | |
template<typename... Args> | |
constexpr_atomic reference | emplace_back (Args &&... args) |
Like std::vector::emplace_back(), construct a new element in place at the end(). More... | |
template<class InputIt > | |
constexpr_atomic void | push_back (InputIt first, InputIt last) |
Like std::vector::push_back(), but appends the whole value_type range [first, last). More... | |
constexpr_atomic 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_atomic 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 |
Implementation of a Copy-On-Write (CoW) using jau::darray as the underlying storage, exposing lock-free read operations using SC-DRF atomic synchronization.
This class shall be compliant with C++ named requirements for Container.
The store is owned using a shared reference to the data structure, allowing its replacement on Copy-On-Write (CoW).
Writing to the store utilizes a mutex lock to avoid data races on the instances' write operations only, leaving read operations lock-free.
Write operations replace the store reference with a new instance using jau::sc_atomic_critical to synchronize with read operations.
Reading from the store is lock-free and accesses the store reference using jau::sc_atomic_critical to synchronizing with write operations.
Immutable storage const_iterators are supported via jau::cow_ro_iterator, which are constructed lock-free.
jau::cow_ro_iterator holds a snapshot retrieved via jau::cow_darray::snapshot() until its destruction.
Mutable storage iterators are supported via jau::cow_rw_iterator, which holds a copy of this CoW storage and locks its write mutex until jau::cow_rw_iterator::write_back() or its destruction.
After completing all mutable operations but before this iterator's destruction, the user might want to write back this iterators' storage to this CoW using jau::cow_rw_iterator::write_back().
Both, jau::cow_ro_iterator and jau::cow_rw_iterator are harmonized to work with jau::darray::const_iterator and jau::darray::iterator for all iterator based operations.
Index operation via ::operator[](size_t) or ::at(size_t) are not supported, since they would be only valid if value_type itself is a std::shared_ptr and hence prohibit the destruction of the object if mutating the storage, e.g. via jau::cow_darray::push_back().
Custom mutable write operations are also supported via jau::cow_darray::get_write_mutex(), jau::cow_darray::copy_store() and jau::cow_darray::set_store().
See example in jau::cow_darray::set_store()
To allow data-race free operations using iterators from a potentially mutated CoW, only one cow_darray::begin() const_iterator or iterator should be retrieved from this CoW and all further operations shall use its jau::cow_ro_iterator::size(), jau::cow_ro_iterator::begin() and jau::cow_ro_iterator::end()
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).
See also:
Definition at line 129 of file cow_darray.hpp.
typedef Alloc_type jau::cow_darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::allocator_type |
Definition at line 148 of file cow_darray.hpp.
typedef cow_ro_iterator<storage_t, storage_ref_t, cow_container_t> jau::cow_darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::const_iterator |
Immutable, read-only const_iterator, lock-free, holding the current shared store reference until destruction.
Using jau::cow_darray::snapshot() at construction.
This iterator is the preferred choice if no mutations are made to the elements state itself, or all changes can be discarded after the iterator's destruction.
This avoids the costly mutex lock and storage copy of jau::cow_rw_iterator.
Also see jau::for_each_fidelity to iterate through in this good faith fashion.
Definition at line 181 of file cow_darray.hpp.
typedef const value_type* jau::cow_darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::const_pointer |
Definition at line 143 of file cow_darray.hpp.
typedef const value_type& jau::cow_darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::const_reference |
Definition at line 145 of file cow_darray.hpp.
typedef cow_darray<value_type, allocator_type, size_type, use_memmove, use_realloc, sec_mem> jau::cow_darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::cow_container_t |
Definition at line 160 of file cow_darray.hpp.
typedef bool jau::cow_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 156 of file cow_darray.hpp.
typedef std::make_signed<size_type>::type jau::cow_darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::difference_type |
Definition at line 147 of file cow_darray.hpp.
typedef bool(* jau::cow_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::cow_darray::push_back_unique().
a | one element of the equality test. |
b | the other element of the equality test. |
Definition at line 921 of file cow_darray.hpp.
typedef cow_rw_iterator<storage_t, storage_ref_t, cow_container_t> jau::cow_darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::iterator |
Mutable, read-write iterator, holding the write-lock and a store copy until destruction.
Using jau::cow_darray::get_write_mutex(), jau::cow_darray::copy_store() at construction
and jau::cow_darray::set_store() at destruction.
Due to the costly nature of mutable CoW resource management, consider using jau::cow_ro_iterator if elements won't get mutated or any changes can be discarded.
Definition at line 200 of file cow_darray.hpp.
typedef value_type* jau::cow_darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::pointer |
Definition at line 142 of file cow_darray.hpp.
typedef value_type& jau::cow_darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::reference |
Definition at line 144 of file cow_darray.hpp.
typedef Size_type jau::cow_darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::size_type |
Definition at line 146 of file cow_darray.hpp.
typedef std::shared_ptr<storage_t> jau::cow_darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::storage_ref_t |
Definition at line 153 of file cow_darray.hpp.
typedef darray<value_type, allocator_type, size_type, use_memmove, use_realloc, sec_mem> jau::cow_darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::storage_t |
Definition at line 152 of file cow_darray.hpp.
typedef Value_type jau::cow_darray< Value_type, Alloc_type, Size_type, use_memmove, use_realloc, sec_mem >::value_type |
Definition at line 141 of file cow_darray.hpp.
|
inlineconstexprnoexcept |
Default constructor, giving almost zero capacity and zero memory footprint, but the shared empty jau::darray.
Definition at line 218 of file cow_darray.hpp.
|
inlineexplicitconstexpr |
Creating an empty instance with initial capacity and other (default) properties.
capacity | initial capacity of the new instance. |
growth_factor | given growth factor |
alloc | given allocator_type |
Definition at line 229 of file cow_darray.hpp.
|
inlineconstexpr |
Definition at line 236 of file cow_darray.hpp.
|
inlineexplicitconstexpr |
Definition at line 242 of file cow_darray.hpp.
|
inlineconstexprnoexcept |
Definition at line 265 of file cow_darray.hpp.
|
inlineexplicitconstexprnoexcept |
Definition at line 272 of file cow_darray.hpp.
|
inline |
Creates a new instance, copying all elements from the given array.
Capacity and size will equal the given array, i.e. the result is a trimmed array.
x | the given cow_darray, all elements will be copied into the new instance. |
Definition at line 305 of file cow_darray.hpp.
|
inlineexplicit |
Creates a new instance, copying all elements from the given array.
Capacity and size will equal the given array, i.e. the result is a trimmed array.
x | the given cow_darray, all elements will be copied into the new instance. |
growth_factor | custom growth factor |
alloc | custom allocator_type instance |
Definition at line 325 of file cow_darray.hpp.
|
inlineexplicit |
Creates a new instance with custom initial storage capacity, copying all elements from the given array.
Size will equal the given array.
Throws jau::IllegalArgumentException() if _capacity < x.size()
.
x | the given cow_darray, all elements will be copied into the new instance. |
_capacity | custom initial storage capacity |
growth_factor | custom growth factor |
alloc | custom allocator_type instance |
Definition at line 349 of file cow_darray.hpp.
|
inlinenoexcept |
Definition at line 388 of file cow_darray.hpp.
|
inlineconstexpr |
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)
.
_capacity | custom initial storage capacity |
first | const_iterator to first element of value_type range [first, last) |
last | const_iterator to last element of value_type range [first, last) |
growth_factor | custom growth factor |
alloc | custom allocator_type instance |
Definition at line 450 of file cow_darray.hpp.
|
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)
.
InputIt | template input-iterator custom type |
_capacity | custom initial storage capacity |
first | template input-iterator to first element of value_type range [first, last) |
last | template input-iterator to last element of value_type range [first, last) |
growth_factor | custom growth factor |
alloc | custom allocator_type instance |
Definition at line 472 of file cow_darray.hpp.
|
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)
.
InputIt | template input-iterator custom type |
first | template input-iterator to first element of value_type range [first, last) |
last | template input-iterator to last element of value_type range [first, last) |
alloc | custom allocator_type instance |
Definition at line 489 of file cow_darray.hpp.
|
inlineconstexpr |
Create a new instance from an initializer list.
initlist | initializer_list. |
alloc | allocator |
Definition at line 501 of file cow_darray.hpp.
|
inlinenoexcept |
Definition at line 508 of file cow_darray.hpp.
|
inlineconstexpr |
Returns an jau::cow_rw_iterator to the first element of this CoW storage.
Acquiring this mutable iterator has considerable costs attached, read remarks in jau::cow_rw_iterator.
Use jau::cow_rw_iterator::end() on this returned iterator to retrieve the end iterator in a data-race free fashion.
Definition at line 659 of file cow_darray.hpp.
|
inlinenoexcept |
Like std::vector::empty().
This read operation is lock-free.
Definition at line 692 of file cow_darray.hpp.
|
inlineconstexprnoexcept |
Returns an jau::cow_ro_iterator to the first element of this CoW storage.
This method is the preferred choice if the use case allows, read remarks in jau::cow_ro_iterator.
Use jau::cow_ro_iterator::end() on this returned const_iterator to retrieve the end const_iterator in a data-race free fashion.
Definition at line 636 of file cow_darray.hpp.
|
inlinenoexcept |
Like std::vector::clear(), but ending with zero capacity.
This write operation uses a mutex lock and is blocking this instances' write operations.
Definition at line 751 of file cow_darray.hpp.
|
inline |
Returns a new shared_ptr copy of the underlying store, i.e.
using a new copy-constructed vectore.
See example in jau::cow_darray::set_store()
This special operation uses a mutex lock and is blocking this instances' write operations only.
Definition at line 550 of file cow_darray.hpp.
|
inline |
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.
args | arguments to forward to the constructor of the element |
Definition at line 865 of file cow_darray.hpp.
|
inlinenoexcept |
Like std::vector::empty().
This read operation is lock-free.
Definition at line 704 of file cow_darray.hpp.
|
inline |
Erase either the first matching element or all matching elements.
This write operation uses a mutex lock and is blocking this instances' write operations only.
Examples
cow_darray<Thing> list; int count = list.erase_matching(element, true, [](const Thing &a, const Thing &b) -> bool { return a == b; }); ... static jau::cow_darray<Thing>::equal_comparator thingRefEqComparator = [](const std::shared_ptr<Thing> &a, const std::shared_ptr<Thing> &b) -> bool { return *a == *b; }; ... cow_darray<std::shared_ptr<Thing>> listOfRefs; int count = listOfRefs.erase_matching(element, false, thingRefEqComparator);
x | the value to be added at the tail, if not existing yet. |
all_matching | if true, erase all matching elements, otherwise only the first matching element. |
comparator | the equal comparator to return true if both given elements are equal |
Definition at line 986 of file cow_darray.hpp.
|
inlinenoexcept |
Definition at line 670 of file cow_darray.hpp.
|
inlinenoexcept |
Definition at line 665 of file cow_darray.hpp.
|
inlinenoexcept |
|
inlineconstexprnoexcept |
Returns this instances' recursive write mutex, allowing user to implement more complex mutable write operations.
See example in jau::cow_darray::set_store()
Definition at line 534 of file cow_darray.hpp.
|
inlinenoexcept |
Returns the growth factor.
Definition at line 679 of file cow_darray.hpp.
|
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 519 of file cow_darray.hpp.
|
inline |
Like std::vector::operator=(&), assignment.
This write operation uses a mutex lock and is blocking this instances' write operations only.
Definition at line 368 of file cow_darray.hpp.
|
inline |
Like std::vector::operator=(&), assignment, but copying from the underling jau::darray.
This write operation uses a mutex lock and is blocking this instances' write operations only.
Definition at line 254 of file cow_darray.hpp.
|
inlinenoexcept |
Like std::vector::operator=(&&), move.
This write operation uses a mutex lock and is blocking both cow_vector instance's write operations.
Definition at line 413 of file cow_darray.hpp.
|
inline |
Like std::vector::operator=(&&), move, but taking the underling jau::darray.
This write operation uses a mutex lock and is blocking this instances' write operations only.
Definition at line 285 of file cow_darray.hpp.
|
inlinenoexcept |
Like std::vector::pop_back().
This write operation uses a mutex lock and is blocking this instances' write operations only.
Definition at line 787 of file cow_darray.hpp.
|
inline |
Like std::vector::push_back(), copy.
This write operation uses a mutex lock and is blocking this instances' write operations only.
x | the value to be added at the tail. |
Definition at line 810 of file cow_darray.hpp.
|
inline |
Like std::vector::push_back(), but appends the whole value_type range [first, last).
This write operation uses a mutex lock and is blocking this instances' write operations only.
InputIt | foreign input-iterator to range of value_type [first, last) |
first | first foreign input-iterator to range of value_type [first, last) |
last | last foreign input-iterator to range of value_type [first, last) |
Definition at line 895 of file cow_darray.hpp.
|
inline |
Like std::vector::push_back(), move.
This write operation uses a mutex lock and is blocking this instances' write operations only.
Definition at line 835 of file cow_darray.hpp.
|
inline |
Like std::vector::push_back(), but only if the newly added element does not yet exist.
This write operation uses a mutex lock and is blocking this instances' write operations only.
Examples
static jau::cow_darray<Thing>::equal_comparator thingEqComparator = [](const Thing &a, const Thing &b) -> bool { return a == b; }; ... jau::cow_darray<Thing> list;
bool added = list.push_back_unique(new_element, thingEqComparator); ... cow_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; });
x | the value to be added at the tail, if not existing yet. |
comparator | the equal comparator to return true if both given elements are equal |
Definition at line 948 of file cow_darray.hpp.
|
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().
This write operation uses a mutex lock and is blocking this instances' write operations only.
Definition at line 733 of file cow_darray.hpp.
|
inlinenoexcept |
Replace the current store with the given instance, potentially acquired via jau::cow_darray::copy_store() and mutated while holding the jau::cow_darray::get_write_mutex() lock.
This is a move operation, i.e. the given new_store_ref is invalid on the caller side after this operation.
User shall pass the store via std::move()
cow_darray<std::shared_ptr<Thing>> list; ... { std::lock_guard<std::recursive_mutex> lock(list.get_write_mutex()); std::shared_ptr<std::vector<std::shared_ptr<Thing>>> snapshot = list.copy_store(); ... some fancy mutation ... list.set_store(std::move(snapshot)); }
Above functionality is covered by jau::cow_rw_iterator, see also jau::cow_rw_iterator::write_back()
new_store_ref | the user store to be moved here, replacing the current store. |
Definition at line 587 of file cow_darray.hpp.
|
inlinenoexcept |
Like std::vector::size().
This read operation is lock-free.
Definition at line 716 of file cow_darray.hpp.
|
inlinenoexcept |
Returns the current snapshot of the underlying shared storage by reference.
Note that this snapshot will be outdated by the next (concurrent) write operation.
The returned referenced vector is still valid and not mutated, but does not represent the current content of this cow_darray instance.
This read operation is lock-free.
Definition at line 610 of file cow_darray.hpp.
|
inlinenoexcept |
Like std::vector::swap().
This write operation uses a mutex lock and is blocking both cow_darray instance's write operations.
Definition at line 767 of file cow_darray.hpp.
|
inlinenoexcept |
|
staticconstexpr |
Default growth factor using the golden ratio 1.618.
Definition at line 133 of file cow_darray.hpp.
|
staticconstexpr |
Definition at line 135 of file cow_darray.hpp.
|
staticconstexpr |
Definition at line 136 of file cow_darray.hpp.
|
staticconstexpr |
Definition at line 137 of file cow_darray.hpp.