quanta 0.1.0
Type-safe units for temperature, frequency, electrical and spatial quantities, modeled after std::chrono
Loading...
Searching...
No Matches
quanta::treat_as_inexact< T > Struct Template Reference

Trait to indicate floating-point-like behavior. More...

#include <quanta/core.hpp>

Inheritance diagram for quanta::treat_as_inexact< T >:

Detailed Description

template<typename T>
struct quanta::treat_as_inexact< T >

Trait to indicate floating-point-like behavior.

Specializations for floating-point types return true. User-defined types may specialize this to enable implicit lossy conversions. Applies to every domain.

This trait affects conversion rules and operation availability:

  • Types with treat_as_inexact_v<T> == true allow implicit lossy conversions
  • Modulo operations (%) are disabled for inexact types
  • Affects rounding behavior in musical operations (quanta::frequency::frequency::octave_shift and semitone_shift)
// Enabled for standard floating-point types
static_assert(!treat_as_inexact_v<int>);
constexpr bool treat_as_inexact_v
Definition core.hpp:119
Template Parameters
TThe type to check.

Definition at line 116 of file core.hpp.


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