tenno 0.1.0
Loading...
Searching...
No Matches
tenno::vector< T, Allocator > Class Template Reference

#include <vector.hpp>

Data Structures

struct  iterator
 An iterator to iterate over the data. More...
 
struct  reverse_iterator
 An reverse_iterator to iterate over the data. More...
 

Public Types

using value_type = T
 
using allocator_type = Allocator
 
using size_type = tenno::size
 
using reference = value_type &
 
using const_reference = const value_type &
 
using pointer = typename Allocator::pointer
 
using const_pointer = typename Allocator::const_pointer
 
using difference_type = T
 

Public Member Functions

 vector ()
 
 vector (size_type count, const T &value, const Allocator &alloc=Allocator())
 
 vector (size_type count, const Allocator &alloc=Allocator())
 
 vector (const vector &other)
 
 vector (const vector &other, const Allocator &alloc)
 
 vector (vector &&other)
 
 vector (vector &&other, const Allocator &alloc)
 
 vector (std::initializer_list< T > init, const Allocator &alloc=Allocator())
 
 ~vector ()
 
vectoroperator= (const vector &other)
 
vectoroperator= (vector &&other) noexcept
 
vectoroperator= (std::initializer_list< value_type > ilist)
 
void assign (size_type count, const T &value)
 
void assign (std::initializer_list< T > ilist)
 
void assign_range (const tenno::range< T > &r)
 
allocator_type get_allocator () const
 
expected< tenno::reference_wrapper< T >, tenno::errorat (size_type pos)
 
expected< tenno::reference_wrapper< T >, tenno::erroroperator[] (size_type pos)
 
expected< tenno::reference_wrapper< const T >, tenno::erroroperator[] (size_type pos) const
 
expected< tenno::reference_wrapper< const T >, tenno::errorfront () const
 
expected< tenno::reference_wrapper< const T >, tenno::errorback () const
 
tenno::expected< pointer, tenno::errordata () noexcept
 
tenno::expected< const_pointer, tenno::errordata () const noexcept
 
iterator begin () noexcept
 Get an iterator to the beginning of the data.
 
iterator end () noexcept
 Get an iterator to the end of the data.
 
reverse_iterator rbegin () noexcept
 Get an reverse_iterator to the beginning of the data.
 
reverse_iterator rend () noexcept
 Get an reverse_iterator to the end of the data.
 
bool empty () const noexcept
 
size_type size () const noexcept
 
size_type max_size () const noexcept
 
void reserve (size_type new_cap)
 
size_type capacity () const noexcept
 
void shrink_to_fit () noexcept
 
void clear () noexcept
 
void push_back (const T &value) noexcept
 
void push_back (const T &&value) noexcept
 
template<class... Args>
reference emplace_back (Args &&...args) noexcept
 
void pop_back () noexcept
 
void resize (size_type count) noexcept
 
void resize (size_type count, const value_type &value) noexcept
 
void swap (vector &other) noexcept
 

Detailed Description

template<class T, class Allocator = tenno::allocator<T>>
class tenno::vector< T, Allocator >

Definition at line 21 of file vector.hpp.

Member Typedef Documentation

◆ allocator_type

template<class T , class Allocator = tenno::allocator<T>>
using tenno::vector< T, Allocator >::allocator_type = Allocator

Definition at line 25 of file vector.hpp.

◆ const_pointer

template<class T , class Allocator = tenno::allocator<T>>
using tenno::vector< T, Allocator >::const_pointer = typename Allocator::const_pointer

Definition at line 30 of file vector.hpp.

◆ const_reference

template<class T , class Allocator = tenno::allocator<T>>
using tenno::vector< T, Allocator >::const_reference = const value_type &

Definition at line 28 of file vector.hpp.

◆ difference_type

template<class T , class Allocator = tenno::allocator<T>>
using tenno::vector< T, Allocator >::difference_type = T

Definition at line 31 of file vector.hpp.

◆ pointer

template<class T , class Allocator = tenno::allocator<T>>
using tenno::vector< T, Allocator >::pointer = typename Allocator::pointer

Definition at line 29 of file vector.hpp.

◆ reference

template<class T , class Allocator = tenno::allocator<T>>
using tenno::vector< T, Allocator >::reference = value_type &

Definition at line 27 of file vector.hpp.

◆ size_type

template<class T , class Allocator = tenno::allocator<T>>
using tenno::vector< T, Allocator >::size_type = tenno::size

Definition at line 26 of file vector.hpp.

◆ value_type

template<class T , class Allocator = tenno::allocator<T>>
using tenno::vector< T, Allocator >::value_type = T

Definition at line 24 of file vector.hpp.

Constructor & Destructor Documentation

◆ vector() [1/8]

template<class T , class Allocator = tenno::allocator<T>>
tenno::vector< T, Allocator >::vector ( )
inline

Definition at line 33 of file vector.hpp.

◆ vector() [2/8]

template<class T , class Allocator = tenno::allocator<T>>
tenno::vector< T, Allocator >::vector ( size_type count,
const T & value,
const Allocator & alloc = Allocator() )
inlineexplicit

Definition at line 37 of file vector.hpp.

◆ vector() [3/8]

template<class T , class Allocator = tenno::allocator<T>>
tenno::vector< T, Allocator >::vector ( size_type count,
const Allocator & alloc = Allocator() )
inlineexplicit

Definition at line 48 of file vector.hpp.

◆ vector() [4/8]

template<class T , class Allocator = tenno::allocator<T>>
tenno::vector< T, Allocator >::vector ( const vector< T, Allocator > & other)
inline

Definition at line 54 of file vector.hpp.

◆ vector() [5/8]

template<class T , class Allocator = tenno::allocator<T>>
tenno::vector< T, Allocator >::vector ( const vector< T, Allocator > & other,
const Allocator & alloc )
inline

Definition at line 64 of file vector.hpp.

◆ vector() [6/8]

template<class T , class Allocator = tenno::allocator<T>>
tenno::vector< T, Allocator >::vector ( vector< T, Allocator > && other)
inline

Definition at line 74 of file vector.hpp.

◆ vector() [7/8]

template<class T , class Allocator = tenno::allocator<T>>
tenno::vector< T, Allocator >::vector ( vector< T, Allocator > && other,
const Allocator & alloc )
inline

Definition at line 82 of file vector.hpp.

◆ vector() [8/8]

template<class T , class Allocator = tenno::allocator<T>>
tenno::vector< T, Allocator >::vector ( std::initializer_list< T > init,
const Allocator & alloc = Allocator() )
inline

Definition at line 89 of file vector.hpp.

◆ ~vector()

template<class T , class Allocator = tenno::allocator<T>>
tenno::vector< T, Allocator >::~vector ( )
inline

Definition at line 101 of file vector.hpp.

Member Function Documentation

◆ assign() [1/2]

template<class T , class Allocator = tenno::allocator<T>>
void tenno::vector< T, Allocator >::assign ( size_type count,
const T & value )
inline

Definition at line 157 of file vector.hpp.

◆ assign() [2/2]

template<class T , class Allocator = tenno::allocator<T>>
void tenno::vector< T, Allocator >::assign ( std::initializer_list< T > ilist)
inline

Definition at line 201 of file vector.hpp.

◆ assign_range()

template<class T , class Allocator = tenno::allocator<T>>
void tenno::vector< T, Allocator >::assign_range ( const tenno::range< T > & r)
inline

Definition at line 215 of file vector.hpp.

◆ at()

template<class T , class Allocator = tenno::allocator<T>>
expected< tenno::reference_wrapper< T >, tenno::error > tenno::vector< T, Allocator >::at ( size_type pos)
inline

Definition at line 237 of file vector.hpp.

◆ back()

template<class T , class Allocator = tenno::allocator<T>>
expected< tenno::reference_wrapper< const T >, tenno::error > tenno::vector< T, Allocator >::back ( ) const
inline

Definition at line 286 of file vector.hpp.

◆ begin()

template<class T , class Allocator = tenno::allocator<T>>
iterator tenno::vector< T, Allocator >::begin ( )
inlinenoexcept

Get an iterator to the beginning of the data.

Returns
iterator The iterator to the beginning of the data

Example

tenno::vector<int> vec = {1, 2, 3};
auto begin = vec.begin();
iterator begin() noexcept
Get an iterator to the beginning of the data.
Definition vector.hpp:389

Definition at line 389 of file vector.hpp.

◆ capacity()

template<class T , class Allocator = tenno::allocator<T>>
size_type tenno::vector< T, Allocator >::capacity ( ) const
inlinenoexcept

Definition at line 532 of file vector.hpp.

◆ clear()

template<class T , class Allocator = tenno::allocator<T>>
void tenno::vector< T, Allocator >::clear ( )
inlinenoexcept

Definition at line 553 of file vector.hpp.

◆ data() [1/2]

template<class T , class Allocator = tenno::allocator<T>>
tenno::expected< const_pointer, tenno::error > tenno::vector< T, Allocator >::data ( ) const
inlinenoexcept

Definition at line 308 of file vector.hpp.

◆ data() [2/2]

template<class T , class Allocator = tenno::allocator<T>>
tenno::expected< pointer, tenno::error > tenno::vector< T, Allocator >::data ( )
inlinenoexcept

Definition at line 299 of file vector.hpp.

◆ emplace_back()

template<class T , class Allocator = tenno::allocator<T>>
template<class... Args>
reference tenno::vector< T, Allocator >::emplace_back ( Args &&... args)
inlinenoexcept

Definition at line 573 of file vector.hpp.

◆ empty()

template<class T , class Allocator = tenno::allocator<T>>
bool tenno::vector< T, Allocator >::empty ( ) const
inlinenoexcept

Definition at line 501 of file vector.hpp.

◆ end()

template<class T , class Allocator = tenno::allocator<T>>
iterator tenno::vector< T, Allocator >::end ( )
inlinenoexcept

Get an iterator to the end of the data.

Returns
iterator The iterator to the end of the data

Example

tenno::for_each(vec.begin(), vec.end(), [](int& elem) { elem = 0; });
constexpr UnaryFunc for_each(InputIt first, InputIt last, UnaryFunc f)
Applies the given function f to the result of dereferencing every element in the range [first,...
Definition algorithm.hpp:56

Definition at line 404 of file vector.hpp.

◆ front()

template<class T , class Allocator = tenno::allocator<T>>
expected< tenno::reference_wrapper< const T >, tenno::error > tenno::vector< T, Allocator >::front ( ) const
inline

Definition at line 273 of file vector.hpp.

◆ get_allocator()

template<class T , class Allocator = tenno::allocator<T>>
allocator_type tenno::vector< T, Allocator >::get_allocator ( ) const
inline

Definition at line 232 of file vector.hpp.

◆ max_size()

template<class T , class Allocator = tenno::allocator<T>>
size_type tenno::vector< T, Allocator >::max_size ( ) const
inlinenoexcept

Definition at line 511 of file vector.hpp.

◆ operator=() [1/3]

template<class T , class Allocator = tenno::allocator<T>>
vector & tenno::vector< T, Allocator >::operator= ( const vector< T, Allocator > & other)
inline

Definition at line 108 of file vector.hpp.

◆ operator=() [2/3]

template<class T , class Allocator = tenno::allocator<T>>
vector & tenno::vector< T, Allocator >::operator= ( std::initializer_list< value_type > ilist)
inline

Definition at line 142 of file vector.hpp.

◆ operator=() [3/3]

template<class T , class Allocator = tenno::allocator<T>>
vector & tenno::vector< T, Allocator >::operator= ( vector< T, Allocator > && other)
inlinenoexcept

Definition at line 125 of file vector.hpp.

◆ operator[]() [1/2]

template<class T , class Allocator = tenno::allocator<T>>
expected< tenno::reference_wrapper< T >, tenno::error > tenno::vector< T, Allocator >::operator[] ( size_type pos)
inline

Definition at line 246 of file vector.hpp.

◆ operator[]() [2/2]

template<class T , class Allocator = tenno::allocator<T>>
expected< tenno::reference_wrapper< const T >, tenno::error > tenno::vector< T, Allocator >::operator[] ( size_type pos) const
inline

Definition at line 260 of file vector.hpp.

◆ pop_back()

template<class T , class Allocator = tenno::allocator<T>>
void tenno::vector< T, Allocator >::pop_back ( )
inlinenoexcept

Definition at line 579 of file vector.hpp.

◆ push_back() [1/2]

template<class T , class Allocator = tenno::allocator<T>>
void tenno::vector< T, Allocator >::push_back ( const T && value)
inlinenoexcept

Definition at line 568 of file vector.hpp.

◆ push_back() [2/2]

template<class T , class Allocator = tenno::allocator<T>>
void tenno::vector< T, Allocator >::push_back ( const T & value)
inlinenoexcept

Definition at line 558 of file vector.hpp.

◆ rbegin()

template<class T , class Allocator = tenno::allocator<T>>
reverse_iterator tenno::vector< T, Allocator >::rbegin ( )
inlinenoexcept

Get an reverse_iterator to the beginning of the data.

Returns
reverse_iterator The iterator to the beginning of the data

Example

tenno::vector<int> vec = {1, 2, 3};
auto begin = vec.rbegin();
reverse_iterator rbegin() noexcept
Get an reverse_iterator to the beginning of the data.
Definition vector.hpp:481

Definition at line 481 of file vector.hpp.

◆ rend()

template<class T , class Allocator = tenno::allocator<T>>
reverse_iterator tenno::vector< T, Allocator >::rend ( )
inlinenoexcept

Get an reverse_iterator to the end of the data.

Returns
reverse_iterator The iterator to the end of the data

Example

tenno::for_each(vec.rbegin(), vec.rend(), [](int& elem) { elem = 0; });

Definition at line 496 of file vector.hpp.

◆ reserve()

template<class T , class Allocator = tenno::allocator<T>>
void tenno::vector< T, Allocator >::reserve ( size_type new_cap)
inline

Definition at line 516 of file vector.hpp.

◆ resize() [1/2]

template<class T , class Allocator = tenno::allocator<T>>
void tenno::vector< T, Allocator >::resize ( size_type count)
inlinenoexcept

Definition at line 588 of file vector.hpp.

◆ resize() [2/2]

template<class T , class Allocator = tenno::allocator<T>>
void tenno::vector< T, Allocator >::resize ( size_type count,
const value_type & value )
inlinenoexcept

Definition at line 599 of file vector.hpp.

◆ shrink_to_fit()

template<class T , class Allocator = tenno::allocator<T>>
void tenno::vector< T, Allocator >::shrink_to_fit ( )
inlinenoexcept

Definition at line 537 of file vector.hpp.

◆ size()

template<class T , class Allocator = tenno::allocator<T>>
size_type tenno::vector< T, Allocator >::size ( ) const
inlinenoexcept

Definition at line 506 of file vector.hpp.

◆ swap()

template<class T , class Allocator = tenno::allocator<T>>
void tenno::vector< T, Allocator >::swap ( vector< T, Allocator > & other)
inlinenoexcept

Definition at line 610 of file vector.hpp.


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