FNumericUnit

[FNumericUnit](API\Runtime\Core\Math\FNumericUnit) is a numeric type that wraps the templated type, whilst a specified unit.

Windows
MacOS
Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Math/UnitConversion.h

Include

#include "Math/UnitConversion.h"

Syntax

template<typename NumericType>
struct FNumericUnit

Remarks

FNumericUnit is a numeric type that wraps the templated type, whilst a specified unit. It handles conversion to/from related units automatically. The units are considered not to contribute to the type's state, and as such should be considered immutable once set.

Forward declaration of types defined in UnitConversion.h

Variables

Name Description

Public variable

const EUnit

 

Units

The associated units for the value.

Public variable

NumericType

 

Value

The numeric (scalar) value

Constructors

Name Description

Public function

FNumericUnit()

Constructors

Public function

FNumericUnit

(
    const FNumericUnit& Other
)

Copy construction/assignment from the same type

Public function

FNumericUnit

(
    const FNumericUnit< OtherType >& O...
)

Templated Copy construction/assignment from differing numeric types.

Public function

FNumericUnit

(
    const NumericType& InValue,
    EUnit InUnits
)

Functions

Name Description

Public function Const

TOptional< F...

 

ConvertTo

(
    EUnit ToUnits
)

Convert this quantity to a different unit

Public function Const

FNumericUnit...

 

QuantizeUnitsToBestFit()

Quantizes this number to the most appropriate unit for user friendly presentation (e.g. 1000m returns 1km).

Public function Static

TValueOrErro...

 

TryParseExpression

(
    const TCHAR* InExpression,
    EUnit InDefaultUnit,
    const FNumericUnit< NumericType >&...
)

Try and parse an expression into a numeric unit

Public function Static

TOptional< F...

 

TryParseString

(
    const TCHAR* InSource
)

Parse a numeric unit from a string

Operators

Name Description

Public function

FNumericUnit...

 

operator=

(
    const FNumericUnit& Other
)

Public function

FNumericUnit...

 

operator=

(
    const FNumericUnit< OtherType >& O...
)

Public function

FNumericUnit...

 

operator=

(
    const FNumericUnit< OtherType >& O...
)

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss