|
tlx
|
Simpler non-growing vector without initialization. More...
#include <simple_vector.hpp>
Public Types | |
| using | value_type = ValueType |
| using | size_type = size_t |
| using | iterator = value_type * |
| using | const_iterator = const value_type * |
| using | reference = value_type & |
| using | const_reference = const value_type & |
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 & | operator= (const SimpleVector &)=delete |
| non-copyable: delete assignment operator More... | |
| SimpleVector (SimpleVector &&v) noexcept | |
| move-constructor More... | |
| SimpleVector & | operator= (SimpleVector &&v) noexcept |
| move-assignment More... | |
| void | swap (SimpleVector &obj) noexcept |
| swap vector with another one More... | |
| ~SimpleVector () | |
| delete vector More... | |
| iterator | data () noexcept |
| return iterator to beginning of vector More... | |
| const_iterator | data () const noexcept |
| return iterator to beginning of vector More... | |
| size_type | size () const noexcept |
| return number of items in 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... | |
| iterator | end () noexcept |
| return mutable iterator beyond last element More... | |
| const_iterator | end () const noexcept |
| return constant iterator beyond last element More... | |
| const_iterator | cend () const noexcept |
| return constant iterator beyond last element More... | |
| reference | front () noexcept |
| returns reference to the last element in the container More... | |
| const_reference | front () const noexcept |
| returns reference to the first element in the container More... | |
| reference | back () noexcept |
| returns reference to the first element in the container More... | |
| const_reference | back () const noexcept |
| returns reference to the last element in the container 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... | |
| reference | at (size_type i) noexcept |
| return the i-th position of the vector More... | |
| const_reference | at (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... | |
| void | destroy () |
| deallocate contained array More... | |
| void | fill (const value_type &v=value_type()) noexcept |
| Zero the whole array content. More... | |
Protected Attributes | |
| size_type | size_ |
| size of allocated memory More... | |
| value_type * | array_ |
| pointer to allocated memory area More... | |
Static Private Member Functions | |
| static ValueType * | create_array (size_t size) |
| static void | destroy_array (ValueType *array, size_t size) |
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.
| 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.
return the i-th position of the vector
Definition at line 180 of file simple_vector.hpp.
|
inlinenoexcept |
return constant reference to the i-th position of the vector
Definition at line 184 of file simple_vector.hpp.
|
inlinenoexcept |
returns reference to the first element in the container
Definition at line 162 of file simple_vector.hpp.
|
inlinenoexcept |
returns reference to the last element in the container
Definition at line 166 of file simple_vector.hpp.
|
inlinenoexcept |
return mutable iterator to first element
Definition at line 128 of file simple_vector.hpp.
|
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 216 of file simple_vector.hpp.
|
inlinenoexcept |
return iterator to beginning of vector
Definition at line 115 of file simple_vector.hpp.
|
inlinenoexcept |
return iterator to beginning of vector
Definition at line 119 of file simple_vector.hpp.
|
inline |
deallocate contained array
Definition at line 204 of file simple_vector.hpp.
|
inlinestaticprivate |
Definition at line 231 of file simple_vector.hpp.
|
inlinenoexcept |
return mutable iterator beyond last element
Definition at line 141 of file simple_vector.hpp.
|
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 211 of file simple_vector.hpp.
|
inlinenoexcept |
returns reference to the last element in the container
Definition at line 154 of file simple_vector.hpp.
|
inlinenoexcept |
returns reference to the first element in the container
Definition at line 158 of file simple_vector.hpp.
|
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 171 of file simple_vector.hpp.
|
inlinenoexcept |
return constant reference to the i-th position of the vector
Definition at line 175 of file simple_vector.hpp.
|
inline |
resize the array to contain exactly new_size items
Definition at line 189 of file simple_vector.hpp.
|
inlinenoexcept |
return number of items in vector
Definition at line 123 of file simple_vector.hpp.
|
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.