Tensor Tiling Library
 
Loading...
Searching...
No Matches
StrongTypeConversion< TARGET_TYPE, SOURCE_TYPE, CONVERSION_MULTIPLY, CONVERSION_DIVISION > Struct Template Reference

Wrapper to allow a single conversion to another type. More...

#include <TTL_strong_type.h>

Inheritance diagram for StrongTypeConversion< TARGET_TYPE, SOURCE_TYPE, CONVERSION_MULTIPLY, CONVERSION_DIVISION >:
Collaboration diagram for StrongTypeConversion< TARGET_TYPE, SOURCE_TYPE, CONVERSION_MULTIPLY, CONVERSION_DIVISION >:

Public Member Functions

 StrongTypeConversion (SOURCE_TYPE source_value)
 
 operator TARGET_TYPE () const
 

Detailed Description

template<typename TARGET_TYPE, typename SOURCE_TYPE, uint32_t CONVERSION_MULTIPLY, uint32_t CONVERSION_DIVISION>
struct StrongTypeConversion< TARGET_TYPE, SOURCE_TYPE, CONVERSION_MULTIPLY, CONVERSION_DIVISION >

Wrapper to allow a single conversion to another type.

For example

Conversion from Hz to Mhz can be achieved by defining

using FrequencyHzToMHz = StrongTypeConversion<FrequencyMHz, FrequencyHz, 1, 1000000>;

Then

FrequencyHz hz(1000000); FrequencyHz mhz = HzToMHz(hz);

Would give mhz = 1.

Definition at line 318 of file TTL_strong_type.h.

Constructor & Destructor Documentation

◆ StrongTypeConversion()

template<typename TARGET_TYPE, typename SOURCE_TYPE, uint32_t CONVERSION_MULTIPLY, uint32_t CONVERSION_DIVISION>
StrongTypeConversion< TARGET_TYPE, SOURCE_TYPE, CONVERSION_MULTIPLY, CONVERSION_DIVISION >::StrongTypeConversion ( SOURCE_TYPE source_value)
inline

Definition at line 319 of file TTL_strong_type.h.

Member Function Documentation

◆ operator TARGET_TYPE()

template<typename TARGET_TYPE, typename SOURCE_TYPE, uint32_t CONVERSION_MULTIPLY, uint32_t CONVERSION_DIVISION>
StrongTypeConversion< TARGET_TYPE, SOURCE_TYPE, CONVERSION_MULTIPLY, CONVERSION_DIVISION >::operator TARGET_TYPE ( ) const
inline

Definition at line 326 of file TTL_strong_type.h.


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