4.6.0
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
fcppt::math::dim::object< T, N, S > Class Template Reference

Detailed Description

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

A class representing a static n-dimensional dimension.

Template Parameters
TThe dim's value_type
NThe dim's dimension type (this is not necessarily a number!)
SThe dim's storage type

See fcppt.math.dim for more information.

Public Types

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

Public Member Functions

 object (fcppt::no_init const &)
 Construct an uninitialized dim.
 
 object (storage_type &&)
 Construct a dim from a storage source.
 
template<typename... Args>
requires (std::conjunction_v< fcppt::math::is_static_storage<S>, std::bool_constant<sizeof...(Args) == N>, std::is_constructible<T, Args>...>)
constexpr object (Args &&...) noexcept(std::conjunction_v< std::is_nothrow_constructible< T, Args >... >)
 
template<typename OtherStorage >
 object (fcppt::math::dim::object< T, N, OtherStorage > const &)
 Create a dim from a dim with the same dimension and value type but different storage type.
 
template<typename OtherStorage >
objectoperator= (fcppt::math::dim::object< T, N, OtherStorage > const &)
 Copy the values from a different dim.
 
template<typename S2 >
objectoperator+= (object< T, N, S2 > const &)
 Add a dim.
 
template<typename S2 >
objectoperator-= (object< T, N, S2 > const &)
 Subtract a dim.
 
template<typename S2 >
objectoperator*= (object< T, N, S2 > const &)
 Multiply by a dim.
 
objectoperator*= (value_type const &)
 Multiply a dim by a scalar.
 
reference get_unsafe (size_type)
 Returns a reference to the dim element at a specified position.
 
const_reference get_unsafe (size_type) const
 Returns a reference to the dim element at a specified position.
 
reference w ()
 Returns a reference to the first element in the dim.
 
const_reference w () const
 Returns a reference to the first element in the dim.
 
reference h ()
 Returns a reference to the second element in the dim.
 
const_reference h () const
 Returns a reference to the second element in the dim.
 
reference d ()
 Returns a reference to the third element in the dim.
 
const_reference d () const
 Returns a reference to the third element in the dim.
 
S & storage ()
 
S const & storage () const
 

Member Typedef Documentation

◆ const_reference

template<typename T , fcppt::math::size_type N, typename S >
using fcppt::math::dim::object< T, N, S >::const_reference = typename storage_type::const_reference

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

◆ difference_type

template<typename T , fcppt::math::size_type N, typename S >
using fcppt::math::dim::object< T, N, S >::difference_type = fcppt::math::difference_type

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

◆ dim_wrapper

template<typename T , fcppt::math::size_type N, typename S >
using fcppt::math::dim::object< T, N, S >::dim_wrapper = fcppt::math::static_size<N>

A typedef for the N parameter.

◆ reference

template<typename T , fcppt::math::size_type N, typename S >
using fcppt::math::dim::object< T, N, S >::reference = typename storage_type::reference

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

◆ size_type

template<typename T , fcppt::math::size_type N, typename S >
using fcppt::math::dim::object< T, N, S >::size_type = fcppt::math::size_type

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

◆ static_size

template<typename T , fcppt::math::size_type N, typename S >
using fcppt::math::dim::object< T, N, S >::static_size = dim_wrapper

◆ storage_type

template<typename T , fcppt::math::size_type N, typename S >
using fcppt::math::dim::object< T, N, S >::storage_type = S

A typedef for the S parameter.

◆ value_type

template<typename T , fcppt::math::size_type N, typename S >
using fcppt::math::dim::object< T, N, S >::value_type = T

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

Constructor & Destructor Documentation

◆ object() [1/4]

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

Construct an uninitialized dim.

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

◆ object() [2/4]

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

Construct a dim from a storage source.

◆ object() [3/4]

template<typename T , fcppt::math::size_type N, typename S >
template<typename... Args>
requires (std::conjunction_v< fcppt::math::is_static_storage<S>, std::bool_constant<sizeof...(Args) == N>, std::is_constructible<T, Args>...>)
fcppt::math::dim::object< T, N, S >::object ( Args && ...) const
explicitconstexprnoexcept

◆ object() [4/4]

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

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

Template Parameters
OtherStorageThe other dim's storage type

Member Function Documentation

◆ d() [1/2]

template<typename T , fcppt::math::size_type N, typename S >
reference fcppt::math::dim::object< T, N, S >::d ( )
nodiscard

Returns a reference to the third element in the dim.

◆ d() [2/2]

template<typename T , fcppt::math::size_type N, typename S >
const_reference fcppt::math::dim::object< T, N, S >::d ( ) const
nodiscard

Returns a reference to the third element in the dim.

◆ get_unsafe() [1/2]

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

Returns a reference to the dim 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 >
const_reference fcppt::math::dim::object< T, N, S >::get_unsafe ( size_type ) const
nodiscard

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

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

◆ h() [1/2]

template<typename T , fcppt::math::size_type N, typename S >
reference fcppt::math::dim::object< T, N, S >::h ( )
nodiscard

Returns a reference to the second element in the dim.

◆ h() [2/2]

template<typename T , fcppt::math::size_type N, typename S >
const_reference fcppt::math::dim::object< T, N, S >::h ( ) const
nodiscard

Returns a reference to the second element in the dim.

◆ operator*=() [1/2]

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

Multiply by a dim.

◆ operator*=() [2/2]

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

Multiply a dim by a scalar.

◆ operator+=()

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

Add a dim.

◆ operator-=()

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

Subtract a dim.

◆ operator=()

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

Copy the values from a different dim.

Template Parameters
OtherStorageThe other dim's storage type

◆ storage() [1/2]

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

◆ storage() [2/2]

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

◆ w() [1/2]

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

Returns a reference to the first element in the dim.

◆ w() [2/2]

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

Returns a reference to the first element in the dim.