Chemical Data Processing Library C++ API - Version 1.4.0
Public Types | Public Member Functions | Friends | List of all members
CDPL::Math::ScalarVector< T > Class Template Reference

Constant vector expression in which every element equals the same scalar value. More...

#include <Vector.hpp>

+ Inheritance diagram for CDPL::Math::ScalarVector< T >:

Public Types

typedef T ValueType
 The scalar value type. More...
 
typedef const T & Reference
 Reference type (always a const reference — elements are immutable). More...
 
typedef const T & ConstReference
 Constant reference type to an element. More...
 
typedef std::size_t SizeType
 The unsigned size type. More...
 
typedef std::ptrdiff_t DifferenceType
 The signed difference type. More...
 
typedef VectorReference< SelfTypeClosureType
 Closure type used when this vector appears inside another expression. More...
 
typedef const VectorReference< const SelfTypeConstClosureType
 Constant closure type used when this vector appears inside another expression. More...
 
typedef Vector< T > VectorTemporaryType
 Concrete temporary vector type used by expression-template machinery. More...
 
- Public Types inherited from CDPL::Math::VectorContainer< ScalarVector< T > >
typedef ScalarVector< T > ContainerType
 The derived vector container type. More...
 
- Public Types inherited from CDPL::Math::VectorExpression< E >
typedef E ExpressionType
 The derived vector expression type. More...
 
- Public Types inherited from CDPL::Math::Expression< E >
typedef E ExpressionType
 The derived expression type (made available to expression-template machinery). More...
 

Public Member Functions

 ScalarVector ()
 Constructs an empty scalar vector. More...
 
 ScalarVector (SizeType n, const ValueType &v=ValueType())
 Constructs a scalar vector of size n in which every element equals v. More...
 
 ScalarVector (const ScalarVector &v)
 Constructs a copy of the scalar vector v. More...
 
ConstReference operator[] (SizeType i) const
 Returns a const reference to the common element value (alias for operator()). More...
 
ConstReference operator() (SizeType i) const
 Returns a const reference to the common element value. More...
 
bool isEmpty () const
 Tells whether the vector has zero logical size. More...
 
SizeType getSize () const
 Returns the logical element count. More...
 
SizeType getMaxSize () const
 Returns the maximum representable element count. More...
 
ScalarVectoroperator= (const ScalarVector &v)
 Copy-assigns the size and common value from v. More...
 
void resize (SizeType n)
 Resizes the logical element count to n. More...
 
void swap (ScalarVector &v)
 Swaps the size and common value with v. More...
 
- Public Member Functions inherited from CDPL::Math::VectorContainer< ScalarVector< T > >
const ContainerTypeoperator() () const
 Returns a const reference to the derived vector container. More...
 
ContainerTypeoperator() ()
 Returns a reference to the derived vector container. More...
 
- Public Member Functions inherited from CDPL::Math::VectorExpression< E >
const ExpressionTypeoperator() () const
 Returns a const reference to the derived vector expression. More...
 
ExpressionTypeoperator() ()
 Returns a reference to the derived vector expression. More...
 

Friends

void swap (ScalarVector &v1, ScalarVector &v2)
 ADL-enabled free-function form of swap(). More...
 

Additional Inherited Members

- Protected Member Functions inherited from CDPL::Math::VectorContainer< ScalarVector< T > >
 VectorContainer ()
 
 ~VectorContainer ()
 
- Protected Member Functions inherited from CDPL::Math::VectorExpression< E >
 VectorExpression ()
 
 ~VectorExpression ()
 
- Protected Member Functions inherited from CDPL::Math::Expression< E >
 Expression ()
 
 ~Expression ()
 

Detailed Description

template<typename T>
class CDPL::Math::ScalarVector< T >

Constant vector expression in which every element equals the same scalar value.

Template Parameters
TThe scalar value type.

Member Typedef Documentation

◆ ValueType

template<typename T >
typedef T CDPL::Math::ScalarVector< T >::ValueType

The scalar value type.

◆ Reference

template<typename T >
typedef const T& CDPL::Math::ScalarVector< T >::Reference

Reference type (always a const reference — elements are immutable).

◆ ConstReference

template<typename T >
typedef const T& CDPL::Math::ScalarVector< T >::ConstReference

Constant reference type to an element.

◆ SizeType

template<typename T >
typedef std::size_t CDPL::Math::ScalarVector< T >::SizeType

The unsigned size type.

◆ DifferenceType

template<typename T >
typedef std::ptrdiff_t CDPL::Math::ScalarVector< T >::DifferenceType

The signed difference type.

◆ ClosureType

template<typename T >
typedef VectorReference<SelfType> CDPL::Math::ScalarVector< T >::ClosureType

Closure type used when this vector appears inside another expression.

◆ ConstClosureType

template<typename T >
typedef const VectorReference<const SelfType> CDPL::Math::ScalarVector< T >::ConstClosureType

Constant closure type used when this vector appears inside another expression.

◆ VectorTemporaryType

template<typename T >
typedef Vector<T> CDPL::Math::ScalarVector< T >::VectorTemporaryType

Concrete temporary vector type used by expression-template machinery.

Constructor & Destructor Documentation

◆ ScalarVector() [1/3]

template<typename T >
CDPL::Math::ScalarVector< T >::ScalarVector ( )
inline

Constructs an empty scalar vector.

◆ ScalarVector() [2/3]

template<typename T >
CDPL::Math::ScalarVector< T >::ScalarVector ( SizeType  n,
const ValueType v = ValueType() 
)
inline

Constructs a scalar vector of size n in which every element equals v.

Parameters
nThe element count.
vThe common element value.

◆ ScalarVector() [3/3]

template<typename T >
CDPL::Math::ScalarVector< T >::ScalarVector ( const ScalarVector< T > &  v)
inline

Constructs a copy of the scalar vector v.

Parameters
vThe scalar vector to copy.

Member Function Documentation

◆ operator[]()

template<typename T >
ConstReference CDPL::Math::ScalarVector< T >::operator[] ( SizeType  i) const
inline

Returns a const reference to the common element value (alias for operator()).

Parameters
iThe zero-based element index.
Returns
A const reference to the common element value.
Exceptions
Base::IndexErrorif i is out of range.

◆ operator()()

template<typename T >
ConstReference CDPL::Math::ScalarVector< T >::operator() ( SizeType  i) const
inline

Returns a const reference to the common element value.

Parameters
iThe zero-based element index.
Returns
A const reference to the common element value.
Exceptions
Base::IndexErrorif i is out of range.

◆ isEmpty()

template<typename T >
bool CDPL::Math::ScalarVector< T >::isEmpty ( ) const
inline

Tells whether the vector has zero logical size.

Returns
true if the logical size is zero, and false otherwise.

◆ getSize()

template<typename T >
SizeType CDPL::Math::ScalarVector< T >::getSize ( ) const
inline

Returns the logical element count.

Returns
The element count.

◆ getMaxSize()

template<typename T >
SizeType CDPL::Math::ScalarVector< T >::getMaxSize ( ) const
inline

Returns the maximum representable element count.

Returns
The maximum element count.

◆ operator=()

template<typename T >
ScalarVector& CDPL::Math::ScalarVector< T >::operator= ( const ScalarVector< T > &  v)
inline

Copy-assigns the size and common value from v.

Parameters
vThe source scalar vector.
Returns
A reference to itself.

◆ resize()

template<typename T >
void CDPL::Math::ScalarVector< T >::resize ( SizeType  n)
inline

Resizes the logical element count to n.

Parameters
nThe new element count.

◆ swap()

template<typename T >
void CDPL::Math::ScalarVector< T >::swap ( ScalarVector< T > &  v)
inline

Swaps the size and common value with v.

Parameters
vThe scalar vector to swap with.

Friends And Related Function Documentation

◆ swap

template<typename T >
void swap ( ScalarVector< T > &  v1,
ScalarVector< T > &  v2 
)
friend

ADL-enabled free-function form of swap().

Parameters
v1The first scalar vector.
v2The second scalar vector.

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