CVB++ 14.0
RefValue< T, K > Class Template Referencefinal

This class holds mutable references to K values of type T. More...

#include <cvb/block.hpp>

Public Member Functions

template<class... TT>
 RefValue (TT &... refs)
 Constructor from reference values. More...
 
 RefValue (const RefValue &) noexcept=default
 Default copy Ctor.
 
RefValueoperator= (const RefValue &) noexcept=default
 Default copy assignment.
 
template<class Ty >
RefValue< T, K > & operator= (const Ty &other) noexcept
 Assignment from any type, for which get<size_t>(Ty) function exists. The values pointed to by this class are overwritten by those of other. More...
 
template<size_t N>
RefValue< T, K > & operator= (const T(&list)[N]) noexcept
 Assignment from a N-element initializer list or array. The values pointed to by this class are overwritten by those of the initializer list. More...
 
template<class Ty >
Ty Cast () const noexcept
 Cast to any type, for which a set<size_t>(Ty) function exists. More...
 
X () const noexcept
 Get const value of the first (x) value. More...
 
T & X () noexcept
 Get reference to the first (x) value. More...
 
template<size_t N = K, std::enable_if_t< less< 1, N >::value, int > = 0>
Y () const noexcept
 Get const value of the second (y) value. More...
 
template<size_t N = K, std::enable_if_t< less< 1, N >::value, int > = 0>
T & Y () noexcept
 Get reference to the second (y) value. More...
 
template<size_t N = K, std::enable_if_t< less< 2, N >::value, int > = 0>
Z () const noexcept
 Get const value of the third (z) value. More...
 
template<size_t N = K, std::enable_if_t< less< 2, N >::value, int > = 0>
T & Z () noexcept
 Get reference to the third (z) value. More...
 
template<size_t N = K, std::enable_if_t< less< 3, N >::value, int > = 0>
W () const noexcept
 Get const value of the fourth (w) value. More...
 
template<size_t N = K, std::enable_if_t< less< 3, N >::value, int > = 0>
T & W () noexcept
 Get reference to the fourth (w) value. More...
 
operator[] (size_t i) const noexcept
 Element access. More...
 
T & operator[] (size_t i) noexcept
 Mutable element access. More...
 

Static Public Member Functions

static constexpr const size_t NumValues () noexcept
 Get number of values stored in this RefValue. More...
 

Related Functions

(Note that these are not member functions.)

template<size_t I, class T , size_t K, std::enable_if_t< less< I, K >::value, int > = 0>
auto get (const RefValue< T, K > &refVal) noexcept -> decltype(refVal[I])
 Get's the I-th element of the RefValue<T,K>. More...
 
template<size_t I, class T , size_t K, std::enable_if_t< less< I, K >::value, int > = 0>
void set (RefValue< T, K > &refVal, const T &val) noexcept
 Set's the value of the I-th element in the RefValue<T,K> refVal. More...
 

Detailed Description

template<class T, size_t K>
class Cvb::RefValue< T, K >

This class holds mutable references to K values of type T.

See also
Block, Visit

Constructor & Destructor Documentation

◆ RefValue()

RefValue ( TT &...  refs)
inlineexplicit

Constructor from reference values.

Parameters
[in]refsK references to values that are stored in the order of the parameters.

Member Function Documentation

◆ Cast()

Ty Cast ( ) const
inlinenoexcept

Cast to any type, for which a set<size_t>(Ty) function exists.

Template Parameters
TyTarget type, for which a Cvb::set<size_t>(Ty) function exists.
Returns
A newly constructed object of Ty.

◆ NumValues()

static constexpr const size_t NumValues ( )
inlinestaticconstexprnoexcept

Get number of values stored in this RefValue.

Returns
size_t The number of values K.

◆ operator=() [1/2]

RefValue< T, K > & operator= ( const T(&)  list[N])
inlinenoexcept

Assignment from a N-element initializer list or array. The values pointed to by this class are overwritten by those of the initializer list.

Template Parameters
NThe number of values. Must be equal to K.
Parameters
[in]listN-element initializer list or array.
Returns
Reference to this RefValue.

◆ operator=() [2/2]

RefValue< T, K > & operator= ( const Ty &  other)
inlinenoexcept

Assignment from any type, for which get<size_t>(Ty) function exists. The values pointed to by this class are overwritten by those of other.

Parameters
[in]otherObject of any type Ty to copy values from. A get<size_t>(Ty) function has to be provided elsewhere and should be defined for 0,..,K-1.
Returns
Reference to this RefValue.

◆ operator[]() [1/2]

T operator[] ( size_t  i) const
inlinenoexcept

Element access.

Parameters
[in]iThe index of the requested element.
Returns
T The value of the i-th element.

◆ operator[]() [2/2]

T & operator[] ( size_t  i)
inlinenoexcept

Mutable element access.

Parameters
[in]iThe index of the requested element.
Returns
T The reference to the i-th element.

◆ W() [1/2]

T W ( ) const
inlinenoexcept

Get const value of the fourth (w) value.

Returns
The w value.

◆ W() [2/2]

T & W ( )
inlinenoexcept

Get reference to the fourth (w) value.

Returns
Reference to the w value.

◆ X() [1/2]

T X ( ) const
inlinenoexcept

Get const value of the first (x) value.

Returns
The x value.

◆ X() [2/2]

T & X ( )
inlinenoexcept

Get reference to the first (x) value.

Returns
Reference to the x value.

◆ Y() [1/2]

T Y ( ) const
inlinenoexcept

Get const value of the second (y) value.

Returns
The y value.

◆ Y() [2/2]

T & Y ( )
inlinenoexcept

Get reference to the second (y) value.

Returns
Reference to the y value.

◆ Z() [1/2]

T Z ( ) const
inlinenoexcept

Get const value of the third (z) value.

Returns
The z value.

◆ Z() [2/2]

T & Z ( )
inlinenoexcept

Get reference to the third (z) value.

Returns
Reference to the z value.

Friends And Related Function Documentation

◆ get()

auto get ( const RefValue< T, K > &  refVal) -> decltype(refVal[I])
related

Get's the I-th element of the RefValue<T,K>.

See also
Block, Visit
Precondition
I < K
Template Parameters
IThe index of the element.
Parameters
refValThe RefValue<T,K> to retrieve the I-th element from.
Returns
The I-th element of refVal.

◆ set()

void set ( RefValue< T, K > &  refVal,
const T &  val 
)
related

Set's the value of the I-th element in the RefValue<T,K> refVal.

See also
Block, Visit
Precondition
I < K
Template Parameters
IThe index of the element.
Parameters
refValThe RefValue<T,K> to set the I-th value in.
valThe value to be written to the I-th element of refVal.