Unit Conversion and Dimensional Analysis Library 3.6.1
A compile-time, header-only C++23 dimensional-analysis library
Loading...
Searching...
No Matches
units::decibels< Underlying > Struct Template Reference

dimensionless unit with decibel scale More...

#include <core.h>

Inheritance diagram for units::decibels< Underlying >:
[legend]
Collaboration diagram for units::decibels< Underlying >:
[legend]

Public Types

using base = ::units::unit<traits::strong_t<dimensionless_>, Underlying, ::units::decibel_scale>
template<class NewUnderlying>
using rebind = decibels<NewUnderlying>
 Re-create this named unit with a different underlying type, so traits (replace_underlying, common_type).
Public Types inherited from units::unit< traits::strong_t< dimensionless_ >, double, ::units::decibel_scale >
using numerical_scale_type
using underlying_type
 < Type of the numerical scale of the unit (e.g. linear_scale)
using value_type
 < Type of the underlying storage of the unit (e.g. double)
using conversion_factor
 < Synonym for underlying type. May be removed in future versions. Prefer underlying_type.

Public Member Functions

 decibels (const decibels &)=default
 decibels (decibels &&)=default
decibels & operator= (const decibels &)=default
decibels & operator= (decibels &&)=default
constexpr decibels (const base &other) noexcept
template<::units::ConversionFactorType Cf, ::units::ArithmeticType Ty, ::units::NumericalScaleType< Ty > Ns>
requires (::units::traits::is_same_dimension_unit_v<::units::unit<Cf, Ty, Ns>, base> &&
!::units::detail::is_losslessly_convertible_unit<::units::unit<Cf, Ty, Ns>, base> && (::std::is_floating_point_v<Ty> ||
::std::is_integral_v<Ty>) && ::std::is_integral_v<Underlying>)
consteval decibels (const ::units::unit< Cf, Ty, Ns > &rhs)
template<class Rhs>
requires ::std::is_arithmetic_v< Rhs > constexpr decibels & operator= (const Rhs &rhs) noexcept
Public Member Functions inherited from units::unit< traits::strong_t< dimensionless_ >, double, ::units::decibel_scale >
constexpr unit & operator= (const unit &rhs) noexcept=default
 default assignment
constexpr bool operator< (const unit< ConversionFactorRhs, Ty, NsRhs > &rhs) const noexcept
 less-than
constexpr bool operator<= (const unit< ConversionFactorRhs, Ty, NsRhs > &rhs) const noexcept
 less-than or equal
constexpr bool operator> (const unit< ConversionFactorRhs, Ty, NsRhs > &rhs) const noexcept
 greater-than
constexpr bool operator>= (const unit< ConversionFactorRhs, Ty, NsRhs > &rhs) const noexcept
 greater-than or equal
constexpr bool operator== (const unit< ConversionFactorRhs, Ty, NsRhs > &rhs) const noexcept
 equality
constexpr bool operator!= (const unit< ConversionFactorRhs, Ty, NsRhs > &rhs) const noexcept
 inequality
constexpr underlying_type raw () const noexcept
 scaled unit value
constexpr auto value () const noexcept
 unit value
constexpr Ty to () const noexcept
 unit value
constexpr T to_linearized () const noexcept
 linearized unit value
constexpr unit< Cf, Ty > convert () const noexcept
 conversion
constexpr operator Ty () const noexcept
 implicit type unsafe conversion.
constexpr operator std::chrono::duration< Rep, Period > () const noexcept
 chrono implicit type conversion.
constexpr const char * name () const noexcept
 returns the unit name
constexpr const char * abbreviation () const noexcept
 returns the unit abbreviation

Additional Inherited Members

Public Attributes inherited from units::unit< traits::strong_t< dimensionless_ >, double, ::units::decibel_scale >
_linearized_value
 Not to be used as part of the official API, this member is public to allow the use of units as NTTP types.

Detailed Description

template<class Underlying = double>
struct units::decibels< Underlying >

dimensionless unit with decibel scale

See also
See unit for more information on unit type containers. A named unit is a CLASS deriving from its unit<...> (not an alias) so a diagnostic prints the friendly name (meters<double>) instead of unit<strong, Underlying, units::decibel_scale> cruft, keeping the decibels<> spelling.

Member Typedef Documentation

◆ rebind

template<class Underlying = double>
template<class NewUnderlying>
using units::decibels< Underlying >::rebind = decibels<NewUnderlying>

Re-create this named unit with a different underlying type, so traits (replace_underlying, common_type).

that swap the storage type PRESERVE the friendly name instead of decaying to the plain unit<...>.


The documentation for this struct was generated from the following file:
  • /home/runner/work/units/units/include/units/core.h