Thrill
0.1
|
Simpler non-growing vector without initialization.
SimpleVector can be used a replacement for std::vector when only a non-growing array of simple types is needed. The advantages of SimpleVector are that it does not initilize memory for POD types (-> faster), while normal structs are supported as well if default-contractible. The simple pointer types allow faster compilation and is less error prone to copying and other problems.
Definition at line 50 of file simple_vector.hpp.
#include <simple_vector.hpp>
Public Types | |
using | const_iterator = const value_type * |
using | const_reference = const value_type & |
using | iterator = value_type * |
using | reference = value_type & |
using | size_type = size_t |
using | value_type = ValueType |
Public Member Functions | |
SimpleVector () | |
allocate empty simple vector More... | |
SimpleVector (const size_type &sz) | |
allocate vector's memory More... | |
SimpleVector (const SimpleVector &)=delete | |
non-copyable: delete copy-constructor More... | |
SimpleVector (SimpleVector &&v) noexcept | |
move-constructor More... | |
~SimpleVector () | |
delete vector More... | |
iterator | begin () noexcept |
return mutable iterator to first element More... | |
const_iterator | begin () const noexcept |
return constant iterator to first element More... | |
const_iterator | cbegin () const noexcept |
return constant iterator to first element More... | |
const_iterator | cend () const noexcept |
return constant iterator beyond last element More... | |
iterator | data () noexcept |
return iterator to beginning of vector More... | |
const_iterator | data () const noexcept |
return iterator to beginning of vector More... | |
void | destroy () |
deallocate contained array More... | |
iterator | end () noexcept |
return mutable iterator beyond last element More... | |
const_iterator | end () const noexcept |
return constant iterator beyond last element More... | |
void | fill (const value_type &v=value_type()) noexcept |
Zero the whole array content. More... | |
SimpleVector & | operator= (const SimpleVector &)=delete |
non-copyable: delete assignment operator More... | |
SimpleVector & | operator= (SimpleVector &&v) noexcept |
move-assignment More... | |
reference | operator[] (size_type i) noexcept |
return the i-th position of the vector More... | |
const_reference | operator[] (size_type i) const noexcept |
return constant reference to the i-th position of the vector More... | |
void | resize (size_type new_size) |
resize the array to contain exactly new_size items More... | |
size_type | size () const noexcept |
return number of items in vector More... | |
void | swap (SimpleVector &obj) noexcept |
swap vector with another one More... | |
Protected Attributes | |
value_type * | array_ |
pointer to allocated memory area More... | |
size_type | size_ |
size of allocated memory More... | |
Static Private Member Functions | |
static ValueType * | create_array (size_t size) |
static void | destroy_array (ValueType *array, size_t size) |
using const_iterator = const value_type * |
Definition at line 67 of file simple_vector.hpp.
using const_reference = const value_type& |
Definition at line 69 of file simple_vector.hpp.
using iterator = value_type * |
Definition at line 66 of file simple_vector.hpp.
using reference = value_type& |
Definition at line 68 of file simple_vector.hpp.
using size_type = size_t |
Definition at line 54 of file simple_vector.hpp.
using value_type = ValueType |
Definition at line 53 of file simple_vector.hpp.
|
inline |
allocate empty simple vector
Definition at line 73 of file simple_vector.hpp.
|
inlineexplicit |
allocate vector's memory
Definition at line 78 of file simple_vector.hpp.
|
delete |
non-copyable: delete copy-constructor
|
inlinenoexcept |
move-constructor
Definition at line 90 of file simple_vector.hpp.
|
inline |
delete vector
Definition at line 110 of file simple_vector.hpp.
|
inlinenoexcept |
return mutable iterator to first element
Definition at line 128 of file simple_vector.hpp.
Referenced by buf_istream_reverse< BlockType, BidIteratorType >::buf_istream_reverse(), foxxll::compute_prefetch_schedule(), tlx::parallel_mergesort_detail::determine_samples(), disk_block_allocator::new_blocks(), tlx::parallel_multiway_merge_base(), tlx::parallel_mergesort_detail::parallel_sort_mwms_pu(), PS5BigSortStep< Context, StringPtr >::sample(), and PS5SmallsortJob< Context, StringPtr, BktSizeType >::SeqSampleSortStep::SeqSampleSortStep().
|
inlinenoexcept |
return constant iterator to first element
Definition at line 132 of file simple_vector.hpp.
|
inlinenoexcept |
return constant iterator to first element
Definition at line 136 of file simple_vector.hpp.
|
inlinenoexcept |
return constant iterator beyond last element
Definition at line 149 of file simple_vector.hpp.
|
inlinestaticprivate |
Definition at line 190 of file simple_vector.hpp.
|
inlinenoexcept |
return iterator to beginning of vector
Definition at line 115 of file simple_vector.hpp.
Referenced by PS5BigSortStep< Context, StringPtr >::count(), PS5BigSortStep< Context, StringPtr >::distribute(), PS5BigSortStep< Context, StringPtr >::distribute_finished(), tlx::parallel_multiway_merge_base(), PS5BigSortStep< Context, StringPtr >::sample(), PS5SmallsortJob< Context, StringPtr, BktSizeType >::SeqSampleSortStep::SeqSampleSortStep(), PS5SmallsortJob< Context, StringPtr, BktSizeType >::sort_mkqs_cache(), PS5SmallsortJob< Context, StringPtr, BktSizeType >::sort_sample_sort(), and PS5BigSortStep< Context, StringPtr >::substep_all_done().
|
inlinenoexcept |
return iterator to beginning of vector
Definition at line 119 of file simple_vector.hpp.
|
inline |
deallocate contained array
Definition at line 178 of file simple_vector.hpp.
Referenced by PS5BigSortStep< Context, StringPtr >::distribute(), PS5BigSortStep< Context, StringPtr >::distribute_finished(), PS5SmallsortJob< Context, StringPtr, BktSizeType >::sort_mkqs_cache(), and PS5BigSortStep< Context, StringPtr >::substep_all_done().
|
inlinestaticprivate |
Definition at line 205 of file simple_vector.hpp.
|
inlinenoexcept |
return mutable iterator beyond last element
Definition at line 141 of file simple_vector.hpp.
Referenced by buf_istream_reverse< BlockType, BidIteratorType >::buf_istream_reverse(), foxxll::compute_prefetch_schedule(), disk_block_allocator::new_blocks(), tlx::parallel_multiway_merge_base(), PS5BigSortStep< Context, StringPtr >::sample(), and PS5SmallsortJob< Context, StringPtr, BktSizeType >::SeqSampleSortStep::SeqSampleSortStep().
|
inlinenoexcept |
return constant iterator beyond last element
Definition at line 145 of file simple_vector.hpp.
|
inlinenoexcept |
Zero the whole array content.
Definition at line 185 of file simple_vector.hpp.
Referenced by block_manager::new_blocks().
|
delete |
non-copyable: delete assignment operator
|
inlinenoexcept |
move-assignment
Definition at line 95 of file simple_vector.hpp.
return the i-th position of the vector
Definition at line 154 of file simple_vector.hpp.
|
inlinenoexcept |
return constant reference to the i-th position of the vector
Definition at line 158 of file simple_vector.hpp.
|
inline |
resize the array to contain exactly new_size items
Definition at line 163 of file simple_vector.hpp.
Referenced by PS5BigSortStep< Context, StringPtr >::count(), tlx::multiway_merge_exact_splitting(), block_manager::new_blocks(), PS5BigSortStep< Context, StringPtr >::PS5BigSortStep(), PS5SmallsortJob< Context, StringPtr, BktSizeType >::run(), and PS5SmallsortJob< Context, StringPtr, BktSizeType >::sort_mkqs_cache().
|
inlinenoexcept |
return number of items in vector
Definition at line 123 of file simple_vector.hpp.
Referenced by buf_istream_reverse< BlockType, BidIteratorType >::buf_istream_reverse(), disk_block_allocator::delete_blocks(), LoserTreeCopyBase< ValueType, Comparator >::insert_start(), LoserTreePointerBase< ValueType, Comparator >::insert_start(), LoserTreeCopyUnguardedBase< ValueType, Comparator >::insert_start(), LoserTreePointerUnguardedBase< ValueType, Comparator >::insert_start(), block_manager::new_blocks(), and PS5SmallsortJob< Context, StringPtr, BktSizeType >::sort_mkqs_cache().
|
inlinenoexcept |
swap vector with another one
Definition at line 104 of file simple_vector.hpp.
|
protected |
pointer to allocated memory area
Definition at line 61 of file simple_vector.hpp.
|
protected |
size of allocated memory
Definition at line 58 of file simple_vector.hpp.