2.10.0
Freundlich's C++ toolkit
Public Types | Public Member Functions
fcppt::math::vector::object< T, N, S > Class Template Reference

Detailed Description

template<typename T, fcppt::math::size_type N, typename S>
class fcppt::math::vector::object< T, N, S >

A class representing static n-dimensional vectors.

Template Parameters
TThe vector's value_type
NThe vector's dimension
SThe vector's storage type

See the module documentation for more information.

Public Types

typedef fcppt::math::static_size< N > dim_wrapper
 A typedef for the N parameter. More...
 
typedef dim_wrapper static_size
 The static size. More...
 
typedef S storage_type
 A typedef for the S parameter. More...
 
typedef fcppt::math::size_type size_type
 A type that counts the number of elements in a vector. More...
 
typedef fcppt::math::difference_type difference_type
 A type that provides the difference between the addresses of two elements in a vector. More...
 
typedef T value_type
 A type that represents the data type stored in a vector. More...
 
typedef storage_type::reference reference
 A type that provides a reference to an element stored in a vector. More...
 
typedef storage_type::const_reference const_reference
 A type that provides a reference to a const element stored in a vector for reading and performing const operations. More...
 

Public Member Functions

 object (fcppt::no_init const &)
 Construct an uninitialized vector. More...
 
 object (storage_type const &)
 Construct a vector from a storage source. More...
 
template<typename ... Args>
 object (Args const &...)
 
 object (object const &)
 Copy-construct the vector from another vector. More...
 
template<typename OtherStorage >
 object (fcppt::math::vector::object< T, N, OtherStorage > const &)
 Create a vector from a vector with the same dimension and value type but different storage type. More...
 
objectoperator= (object const &)
 Copy the values from a different vector. More...
 
template<typename OtherStorage >
objectoperator= (fcppt::math::vector::object< T, N, OtherStorage > const &)
 Copy the values from a different vector. More...
 
 ~object ()
 
template<typename S2 >
objectoperator+= (object< T, N, S2 > const &)
 Add a vector. More...
 
template<typename S2 >
objectoperator-= (object< T, N, S2 > const &)
 Subtract a vector. More...
 
template<typename S2 >
objectoperator*= (object< T, N, S2 > const &)
 Multiply by a vector. More...
 
objectoperator*= (value_type const &)
 Multiply a vector by a scalar. More...
 
const_reference get_unsafe (size_type) const
 Returns a reference to the vector element at a specified position. More...
 
reference get_unsafe (size_type)
 Returns a reference to the vector element at a specified position. More...
 
reference x ()
 Returns a reference to the first element in the vector. More...
 
const_reference x () const
 Returns a reference to the first element in the vector. More...
 
reference y ()
 Returns a reference to the second element in the vector. More...
 
const_reference y () const
 Returns a reference to the second element in the vector. More...
 
reference z ()
 Returns a reference to the third element in the vector. More...
 
const_reference z () const
 Returns a reference to the third element in the vector. More...
 
reference w ()
 Returns a reference to the fourth element in the vector. More...
 
const_reference w () const
 Returns a reference to the fourth element in the vector. More...
 
S & storage ()
 
S const & storage () const
 

Member Typedef Documentation

◆ const_reference

template<typename T, fcppt::math::size_type N, typename S>
typedef storage_type::const_reference fcppt::math::vector::object< T, N, S >::const_reference

A type that provides a reference to a const element stored in a vector for reading and performing const operations.

◆ difference_type

template<typename T, fcppt::math::size_type N, typename S>
typedef fcppt::math::difference_type fcppt::math::vector::object< T, N, S >::difference_type

A type that provides the difference between the addresses of two elements in a vector.

◆ dim_wrapper

template<typename T, fcppt::math::size_type N, typename S>
typedef fcppt::math::static_size< N > fcppt::math::vector::object< T, N, S >::dim_wrapper

A typedef for the N parameter.

◆ reference

template<typename T, fcppt::math::size_type N, typename S>
typedef storage_type::reference fcppt::math::vector::object< T, N, S >::reference

A type that provides a reference to an element stored in a vector.

◆ size_type

template<typename T, fcppt::math::size_type N, typename S>
typedef fcppt::math::size_type fcppt::math::vector::object< T, N, S >::size_type

A type that counts the number of elements in a vector.

◆ static_size

template<typename T, fcppt::math::size_type N, typename S>
typedef dim_wrapper fcppt::math::vector::object< T, N, S >::static_size

The static size.

◆ storage_type

template<typename T, fcppt::math::size_type N, typename S>
typedef S fcppt::math::vector::object< T, N, S >::storage_type

A typedef for the S parameter.

◆ value_type

template<typename T, fcppt::math::size_type N, typename S>
typedef T fcppt::math::vector::object< T, N, S >::value_type

A type that represents the data type stored in a vector.

Constructor & Destructor Documentation

◆ object() [1/5]

template<typename T, fcppt::math::size_type N, typename S>
fcppt::math::vector::object< T, N, S >::object ( fcppt::no_init const &  )
explicit

Construct an uninitialized vector.

Warning
The content of the vector will be undefined (not null) after initialization

◆ object() [2/5]

template<typename T, fcppt::math::size_type N, typename S>
fcppt::math::vector::object< T, N, S >::object ( storage_type const &  )
explicit

Construct a vector from a storage source.

◆ object() [3/5]

template<typename T, fcppt::math::size_type N, typename S>
template<typename ... Args>
fcppt::math::vector::object< T, N, S >::object ( Args const &  ...)
explicit

◆ object() [4/5]

template<typename T, fcppt::math::size_type N, typename S>
fcppt::math::vector::object< T, N, S >::object ( object< T, N, S > const &  )

Copy-construct the vector from another vector.

◆ object() [5/5]

template<typename T, fcppt::math::size_type N, typename S>
template<typename OtherStorage >
fcppt::math::vector::object< T, N, S >::object ( fcppt::math::vector::object< T, N, OtherStorage > const &  )
explicit

Create a vector from a vector with the same dimension and value type but different storage type.

Template Parameters
OtherStorageThe other vector's storage type

◆ ~object()

template<typename T, fcppt::math::size_type N, typename S>
fcppt::math::vector::object< T, N, S >::~object ( )

Member Function Documentation

◆ get_unsafe() [1/2]

template<typename T, fcppt::math::size_type N, typename S>
const_reference fcppt::math::vector::object< T, N, S >::get_unsafe ( size_type  ) const

Returns a reference to the vector element at a specified position.

Warning
Behaviour is undefined if the index is out of range.

◆ get_unsafe() [2/2]

template<typename T, fcppt::math::size_type N, typename S>
reference fcppt::math::vector::object< T, N, S >::get_unsafe ( size_type  )

Returns a reference to the vector element at a specified position.

Warning
Behaviour is undefined if the index is out of range.

◆ operator*=() [1/2]

template<typename T, fcppt::math::size_type N, typename S>
template<typename S2 >
object& fcppt::math::vector::object< T, N, S >::operator*= ( object< T, N, S2 > const &  )

Multiply by a vector.

◆ operator*=() [2/2]

template<typename T, fcppt::math::size_type N, typename S>
object& fcppt::math::vector::object< T, N, S >::operator*= ( value_type const &  )

Multiply a vector by a scalar.

◆ operator+=()

template<typename T, fcppt::math::size_type N, typename S>
template<typename S2 >
object& fcppt::math::vector::object< T, N, S >::operator+= ( object< T, N, S2 > const &  )

Add a vector.

◆ operator-=()

template<typename T, fcppt::math::size_type N, typename S>
template<typename S2 >
object& fcppt::math::vector::object< T, N, S >::operator-= ( object< T, N, S2 > const &  )

Subtract a vector.

◆ operator=() [1/2]

template<typename T, fcppt::math::size_type N, typename S>
object& fcppt::math::vector::object< T, N, S >::operator= ( object< T, N, S > const &  )

Copy the values from a different vector.

◆ operator=() [2/2]

template<typename T, fcppt::math::size_type N, typename S>
template<typename OtherStorage >
object& fcppt::math::vector::object< T, N, S >::operator= ( fcppt::math::vector::object< T, N, OtherStorage > const &  )

Copy the values from a different vector.

Template Parameters
OtherStorageThe other vector's storage type

◆ storage() [1/2]

template<typename T, fcppt::math::size_type N, typename S>
S& fcppt::math::vector::object< T, N, S >::storage ( )

◆ storage() [2/2]

template<typename T, fcppt::math::size_type N, typename S>
S const& fcppt::math::vector::object< T, N, S >::storage ( ) const

◆ w() [1/2]

template<typename T, fcppt::math::size_type N, typename S>
reference fcppt::math::vector::object< T, N, S >::w ( )

Returns a reference to the fourth element in the vector.

◆ w() [2/2]

template<typename T, fcppt::math::size_type N, typename S>
const_reference fcppt::math::vector::object< T, N, S >::w ( ) const

Returns a reference to the fourth element in the vector.

◆ x() [1/2]

template<typename T, fcppt::math::size_type N, typename S>
reference fcppt::math::vector::object< T, N, S >::x ( )

Returns a reference to the first element in the vector.

◆ x() [2/2]

template<typename T, fcppt::math::size_type N, typename S>
const_reference fcppt::math::vector::object< T, N, S >::x ( ) const

Returns a reference to the first element in the vector.

◆ y() [1/2]

template<typename T, fcppt::math::size_type N, typename S>
reference fcppt::math::vector::object< T, N, S >::y ( )

Returns a reference to the second element in the vector.

◆ y() [2/2]

template<typename T, fcppt::math::size_type N, typename S>
const_reference fcppt::math::vector::object< T, N, S >::y ( ) const

Returns a reference to the second element in the vector.

◆ z() [1/2]

template<typename T, fcppt::math::size_type N, typename S>
reference fcppt::math::vector::object< T, N, S >::z ( )

Returns a reference to the third element in the vector.

◆ z() [2/2]

template<typename T, fcppt::math::size_type N, typename S>
const_reference fcppt::math::vector::object< T, N, S >::z ( ) const

Returns a reference to the third element in the vector.