NumericAL
A header-only C++20 lexer built on REAL
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
numerical::vector< T > Class Template Reference

A dense vector of T with value semantics. More...

#include <vector.hpp>

Public Member Functions

 vector ()=default
 An empty vector (size 0).
 
 vector (std::initializer_list< T > elements)
 From a braced list of elements.
 
 vector (buffer< T > elements)
 From an existing buffer.
 
 vector (const std::vector< T > &elements)
 From a std::vector, copied into the storage (a buffer moves in instead).
 
std::size_t size () const noexcept
 The number of elements.
 
const T & operator[] (std::size_t index) const
 The element at index.
 
buffer< T >::const_iterator begin () const noexcept
 Const iterator to the first element.
 
buffer< T >::const_iterator end () const noexcept
 Const iterator past the last element.
 
bool operator== (const vector &other) const
 Exact element-wise equality (same size, equal elements).
 

Private Attributes

buffer< T > data_
 The elements.
 

Detailed Description

template<typename T>
class numerical::vector< T >

A dense vector of T with value semantics.

Template Parameters
TThe scalar element type.

Definition at line 85 of file vector.hpp.

Constructor & Destructor Documentation

◆ vector() [1/4]

template<typename T >
numerical::vector< T >::vector ( )
default

An empty vector (size 0).

◆ vector() [2/4]

template<typename T >
numerical::vector< T >::vector ( std::initializer_list< T >  elements)
inline

From a braced list of elements.

Parameters
[in]elementsThe elements.

Definition at line 93 of file vector.hpp.

◆ vector() [3/4]

template<typename T >
numerical::vector< T >::vector ( buffer< T >  elements)
inlineexplicit

From an existing buffer.

Parameters
[in]elementsThe elements (moved in).

Definition at line 98 of file vector.hpp.

◆ vector() [4/4]

template<typename T >
numerical::vector< T >::vector ( const std::vector< T > &  elements)
inlineexplicit

From a std::vector, copied into the storage (a buffer moves in instead).

Parameters
[in]elementsThe elements.

Definition at line 104 of file vector.hpp.

Member Function Documentation

◆ begin()

template<typename T >
buffer< T >::const_iterator numerical::vector< T >::begin ( ) const
inlinenoexcept

Const iterator to the first element.

Definition at line 121 of file vector.hpp.

◆ end()

template<typename T >
buffer< T >::const_iterator numerical::vector< T >::end ( ) const
inlinenoexcept

Const iterator past the last element.

Definition at line 127 of file vector.hpp.

◆ operator==()

template<typename T >
bool numerical::vector< T >::operator== ( const vector< T > &  other) const
inline

Exact element-wise equality (same size, equal elements).

Definition at line 133 of file vector.hpp.

◆ operator[]()

template<typename T >
const T & numerical::vector< T >::operator[] ( std::size_t  index) const
inline

The element at index.

Precondition
index < size.

Definition at line 115 of file vector.hpp.

◆ size()

template<typename T >
std::size_t numerical::vector< T >::size ( ) const
inlinenoexcept

The number of elements.

Definition at line 109 of file vector.hpp.

Member Data Documentation

◆ data_

template<typename T >
buffer<T> numerical::vector< T >::data_
private

The elements.

Definition at line 140 of file vector.hpp.


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