numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
num_collect::util::vector< T > Class Template Reference

Class of vectors wrapping std::vector class to use singed integers as indices. More...

#include <num_collect/util/vector.h>

+ Inheritance diagram for num_collect::util::vector< T >:
+ Collaboration diagram for num_collect::util::vector< T >:

Public Types

using const_iterator = typename internal_vector_type::const_iterator
 Type of const iterators.
 
using const_pointer = typename internal_vector_type::const_pointer
 Type of const pointers.
 
using const_reference = typename internal_vector_type::const_reference
 Type of const references.
 
using const_reverse_iterator
 Type of const reverse iterators.
 
using difference_type = typename internal_vector_type::difference_type
 Type of differences of pointers.
 
using internal_vector_type = std::vector<T>
 Type of actual vectors.
 
using iterator = typename internal_vector_type::iterator
 Type of iterators.
 
using pointer = typename internal_vector_type::pointer
 Type of pointers.
 
using reference = typename internal_vector_type::reference
 Type of references.
 
using reverse_iterator = typename internal_vector_type::reverse_iterator
 Type of reverse iterators.
 
using size_type = index_type
 Type of sizes.
 
using value_type = typename internal_vector_type::value_type
 Type of values.
 

Public Member Functions

 vector ()=default
 Constructor.
 
 vector (index_type size, value_type value=value_type())
 Constructor.
 
 vector (std::initializer_list< T > values)
 Constructor.
 
auto back () -> reference
 Access to the final element.
 
auto back () const -> const_reference
 Access to the final element.
 
auto begin () -> iterator
 Get the iterator to the first element.
 
auto begin () const -> const_iterator
 Get the iterator to the first element.
 
auto cbegin () const -> const_iterator
 Get the iterator to the first element.
 
auto cend () const -> const_iterator
 Get the past-the-end iterator.
 
void clear ()
 Remove the all elements in this vector.
 
auto data () const noexcept -> const_pointer
 Get the pointer to the first element.
 
auto data () noexcept -> pointer
 Get the pointer to the first element.
 
auto empty () const -> bool
 Check whether this vector is empty.
 
auto end () -> iterator
 Get the past-the-end iterator.
 
auto end () const -> const_iterator
 Get the past-the-end iterator.
 
auto front () -> reference
 Access to the front element.
 
auto front () const -> const_reference
 Access to the front element.
 
auto operator[] (index_type index) -> reference
 Access to an element.
 
auto operator[] (index_type index) const -> const_reference
 Access to an element.
 
void push_back (const value_type &value)
 Add an element.
 
void push_back (value_type &&value)
 Add an element.
 
void reserve (index_type size)
 Reserve memory.
 
void resize (index_type size)
 Change the size.
 
auto size () const -> index_type
 Get the size of this vector.
 

Private Attributes

internal_vector_type vector_
 Actual vector.
 

Detailed Description

template<typename T>
class num_collect::util::vector< T >

Class of vectors wrapping std::vector class to use singed integers as indices.

Template Parameters
TType of values.

Definition at line 37 of file vector.h.

Member Typedef Documentation

◆ const_iterator

template<typename T >
using num_collect::util::vector< T >::const_iterator = typename internal_vector_type::const_iterator

Type of const iterators.

Definition at line 67 of file vector.h.

◆ const_pointer

template<typename T >
using num_collect::util::vector< T >::const_pointer = typename internal_vector_type::const_pointer

Type of const pointers.

Definition at line 61 of file vector.h.

◆ const_reference

template<typename T >
using num_collect::util::vector< T >::const_reference = typename internal_vector_type::const_reference

Type of const references.

Definition at line 55 of file vector.h.

◆ const_reverse_iterator

template<typename T >
using num_collect::util::vector< T >::const_reverse_iterator
Initial value:
typename internal_vector_type::const_reverse_iterator

Type of const reverse iterators.

Definition at line 73 of file vector.h.

◆ difference_type

template<typename T >
using num_collect::util::vector< T >::difference_type = typename internal_vector_type::difference_type

Type of differences of pointers.

Definition at line 49 of file vector.h.

◆ internal_vector_type

template<typename T >
using num_collect::util::vector< T >::internal_vector_type = std::vector<T>

Type of actual vectors.

Definition at line 40 of file vector.h.

◆ iterator

template<typename T >
using num_collect::util::vector< T >::iterator = typename internal_vector_type::iterator

Type of iterators.

Definition at line 64 of file vector.h.

◆ pointer

template<typename T >
using num_collect::util::vector< T >::pointer = typename internal_vector_type::pointer

Type of pointers.

Definition at line 58 of file vector.h.

◆ reference

template<typename T >
using num_collect::util::vector< T >::reference = typename internal_vector_type::reference

Type of references.

Definition at line 52 of file vector.h.

◆ reverse_iterator

template<typename T >
using num_collect::util::vector< T >::reverse_iterator = typename internal_vector_type::reverse_iterator

Type of reverse iterators.

Definition at line 70 of file vector.h.

◆ size_type

template<typename T >
using num_collect::util::vector< T >::size_type = index_type

Type of sizes.

Definition at line 46 of file vector.h.

◆ value_type

template<typename T >
using num_collect::util::vector< T >::value_type = typename internal_vector_type::value_type

Type of values.

Definition at line 43 of file vector.h.

Constructor & Destructor Documentation

◆ vector() [1/3]

template<typename T >
num_collect::util::vector< T >::vector ( )
default

Constructor.

This create an empty vector.

◆ vector() [2/3]

template<typename T >
num_collect::util::vector< T >::vector ( index_type size,
value_type value = value_type() )
inlineexplicit

Constructor.

Parameters
[in]sizeSize.
[in]valueValues to fill the vector.

Definition at line 89 of file vector.h.

◆ vector() [3/3]

template<typename T >
num_collect::util::vector< T >::vector ( std::initializer_list< T > values)
inline

Constructor.

Parameters
[in]valuesInitializer list of values.

Definition at line 97 of file vector.h.

Member Function Documentation

◆ back() [1/2]

template<typename T >
auto num_collect::util::vector< T >::back ( ) -> reference
inlinenodiscard

Access to the final element.

Returns
Reference.

Definition at line 140 of file vector.h.

◆ back() [2/2]

template<typename T >
auto num_collect::util::vector< T >::back ( ) const -> const_reference
inlinenodiscard

Access to the final element.

Returns
Reference.

Definition at line 147 of file vector.h.

◆ begin() [1/2]

template<typename T >
auto num_collect::util::vector< T >::begin ( ) -> iterator
inlinenodiscard

Get the iterator to the first element.

Returns
Iterator.

Definition at line 156 of file vector.h.

◆ begin() [2/2]

template<typename T >
auto num_collect::util::vector< T >::begin ( ) const -> const_iterator
inlinenodiscard

Get the iterator to the first element.

Returns
Iterator.

Definition at line 163 of file vector.h.

◆ cbegin()

template<typename T >
auto num_collect::util::vector< T >::cbegin ( ) const -> const_iterator
inlinenodiscard

Get the iterator to the first element.

Returns
Iterator.

Definition at line 172 of file vector.h.

◆ cend()

template<typename T >
auto num_collect::util::vector< T >::cend ( ) const -> const_iterator
inlinenodiscard

Get the past-the-end iterator.

Returns
Iterator.

Definition at line 195 of file vector.h.

◆ clear()

template<typename T >
void num_collect::util::vector< T >::clear ( )
inline

Remove the all elements in this vector.

Definition at line 251 of file vector.h.

◆ data() [1/2]

template<typename T >
auto num_collect::util::vector< T >::data ( ) const -> const_pointer
inlinenodiscardnoexcept

Get the pointer to the first element.

Returns
Pointer.

Definition at line 209 of file vector.h.

◆ data() [2/2]

template<typename T >
auto num_collect::util::vector< T >::data ( ) -> pointer
inlinenodiscardnoexcept

Get the pointer to the first element.

Returns
Pointer.

Definition at line 202 of file vector.h.

◆ empty()

template<typename T >
auto num_collect::util::vector< T >::empty ( ) const -> bool
inlinenodiscard

Check whether this vector is empty.

Return values
trueThis vector is empty.
falseThis vector is not empty.

Definition at line 219 of file vector.h.

◆ end() [1/2]

template<typename T >
auto num_collect::util::vector< T >::end ( ) -> iterator
inlinenodiscard

Get the past-the-end iterator.

Returns
Iterator.

Definition at line 181 of file vector.h.

◆ end() [2/2]

template<typename T >
auto num_collect::util::vector< T >::end ( ) const -> const_iterator
inlinenodiscard

Get the past-the-end iterator.

Returns
Iterator.

Definition at line 188 of file vector.h.

◆ front() [1/2]

template<typename T >
auto num_collect::util::vector< T >::front ( ) -> reference
inlinenodiscard

Access to the front element.

Returns
Reference.

Definition at line 124 of file vector.h.

◆ front() [2/2]

template<typename T >
auto num_collect::util::vector< T >::front ( ) const -> const_reference
inlinenodiscard

Access to the front element.

Returns
Reference.

Definition at line 131 of file vector.h.

◆ operator[]() [1/2]

template<typename T >
auto num_collect::util::vector< T >::operator[] ( index_type index) -> reference
inlinenodiscard

Access to an element.

Parameters
[in]indexIndex.
Returns
Reference to the element.

Definition at line 105 of file vector.h.

◆ operator[]() [2/2]

template<typename T >
auto num_collect::util::vector< T >::operator[] ( index_type index) const -> const_reference
inlinenodiscard

Access to an element.

Parameters
[in]indexIndex.
Returns
Reference to the element.

Definition at line 115 of file vector.h.

◆ push_back() [1/2]

template<typename T >
void num_collect::util::vector< T >::push_back ( const value_type & value)
inline

Add an element.

Parameters
[in]valueValue of the element.

Definition at line 258 of file vector.h.

◆ push_back() [2/2]

template<typename T >
void num_collect::util::vector< T >::push_back ( value_type && value)
inline

Add an element.

Parameters
[in]valueValue of the element.

Definition at line 265 of file vector.h.

◆ reserve()

template<typename T >
void num_collect::util::vector< T >::reserve ( index_type size)
inline

Reserve memory.

Parameters
[in]sizeSize.

Definition at line 235 of file vector.h.

◆ resize()

template<typename T >
void num_collect::util::vector< T >::resize ( index_type size)
inline

Change the size.

Parameters
[in]sizeSize.

Definition at line 244 of file vector.h.

◆ size()

template<typename T >
auto num_collect::util::vector< T >::size ( ) const -> index_type
inlinenodiscard

Get the size of this vector.

Returns
Size.

Definition at line 226 of file vector.h.

Member Data Documentation

◆ vector_

template<typename T >
internal_vector_type num_collect::util::vector< T >::vector_
private

Actual vector.

Definition at line 269 of file vector.h.


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