General Utility Library for C++14  2.7
Public Member Functions | Public Attributes | List of all members
gul14::StandardDeviationMean< DataT, typename > Class Template Reference

Detailed Description

template<typename DataT, typename = std::enable_if_t<std::is_floating_point<DataT>::value>>
class gul14::StandardDeviationMean< DataT, typename >

A struct holding a standard deviation and a mean value.

DataT must be a floating point type.

Default constructed the contained values are Not-a-Number.

The object can be cast to DataT in which case it is results in the sigma value. DataT is usually statistics_result_type.

The data members are public to allow structured bindings.

Template Parameters
DataTType of the contained values
See also
standard_deviation()

#include <statistics.h>

Public Member Functions

 operator DataT () const noexcept
 Cast to DataT results in standard deviation value. More...
 
auto sigma () const noexcept -> DataT
 Get the standard deviation value.
 
auto mean () const noexcept -> DataT
 Get the arithmetic mean value.
 

Public Attributes

DataT sigma_ { NAN }
 The standard deviation (sigma) value.
 
DataT mean_ { NAN }
 The mean value.
 

Member Function Documentation

◆ operator DataT()

template<typename DataT , typename = std::enable_if_t<std::is_floating_point<DataT>::value>>
gul14::StandardDeviationMean< DataT, typename >::operator DataT ( ) const
inlinenoexcept

Cast to DataT results in standard deviation value.

The conversion operator is not explicit, so any implicit conversion from DataT to the desired type is also conducted.

For example the following works:

auto sdm = StandardDeviationMean<float>{ 3.0, 4.0 };
long double sigma = sdm; // implicit conversion from float to long double

References gul14::StandardDeviationMean< DataT, typename >::sigma_.


The documentation for this class was generated from the following file:
gul14::StandardDeviationMean::sigma
auto sigma() const noexcept -> DataT
Get the standard deviation value.
Definition: statistics.h:120