units
Use physical dimensions at compile-time or run-time.
Public Types | Public Member Functions | Public Attributes | List of all members
vnix::units::basic_number< T > Struct Template Reference

Base-struct for wrapper to disambiguate scalar from dimval and protected storage for numeric value associated with a physical unit. More...

#include <number.hpp>

Inheritance diagram for vnix::units::basic_number< T >:
[legend]
Collaboration diagram for vnix::units::basic_number< T >:
[legend]

Public Types

using scalar = T
 Scalar type. More...
 

Public Member Functions

 basic_number ()
 By default, do not initialize. More...
 
constexpr basic_number (T const &vv)
 Initialize numeric value and exponents of units. More...
 

Public Attributes

v_
 Numeric value that multiplies units. More...
 

Detailed Description

template<typename T>
struct vnix::units::basic_number< T >

Base-struct for wrapper to disambiguate scalar from dimval and protected storage for numeric value associated with a physical unit.

Specialize descendant as necessary to handle different scalar types; for example, a matrix.

The number is protected because it is here abstracted away from the unit, which it needs in order to make any sense. The number is combined with the unit in a descendant class.

Template Parameters
TType of number, typically float or double.

Definition at line 40 of file number.hpp.

Member Typedef Documentation

template<typename T>
using vnix::units::basic_number< T >::scalar = T

Scalar type.

Definition at line 42 of file number.hpp.

Constructor & Destructor Documentation

template<typename T>
vnix::units::basic_number< T >::basic_number ( )
inline

By default, do not initialize.

Definition at line 43 of file number.hpp.

template<typename T>
constexpr vnix::units::basic_number< T >::basic_number ( T const &  vv)
inline

Initialize numeric value and exponents of units.

Parameters
vNumeric value that multiplies units.

Definition at line 47 of file number.hpp.

47 : v_(vv) {}
T v_
Numeric value that multiplies units.
Definition: number.hpp:41

Member Data Documentation

template<typename T>
T vnix::units::basic_number< T >::v_

Numeric value that multiplies units.

Definition at line 41 of file number.hpp.


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