Skip to content

Latest commit

 

History

History
51 lines (34 loc) · 1.52 KB

treat-as-floating-point-structure.md

File metadata and controls

51 lines (34 loc) · 1.52 KB
description title ms.date f1_keywords helpviewer_keywords dev_langs
Learn more about: treat_as_floating_point structure
treat_as_floating_point Structure
07/16/2021
chrono/std::chrono::treat_as_floating_point
std::chrono [C++], treat_as_floating_point
C++

treat_as_floating_point structure

Checks whether the specified type can be treated as a floating-point type.

Syntax

template <class T>
struct treat_as_floating_point : is_floating_point<T>;

Helper variable template

template<class T>
inline constexpr bool treat_as_floating_point_v = treat_as_floating_point<T>::value;

Parameters

T
The type to test.

Remarks

The purpose of this trait is to indicate whether a given class behaves like a floating-point type, and thus allows division of one value by another with acceptable loss of precision. If treat_as_floating_point_v<T> is false, T will be treated as if it behaves as an integral type for these conversions.

The duration template uses the treat_as_floating_point trait to help determine if a duration object can be converted to another duration with a different tick period.

If treat_as_floating_point_v<T> is true, implicit conversions are allowed between durations. Otherwise, the implicit convertibility depends on the tick periods of the durations.

Requirements

Header: <chrono>

Namespace: std::chrono

See also

<chrono>
Header Files Reference