libfxd 0.2.dev
A fixed-point library for C++.
Loading...
Searching...
No Matches
traits.hpp File Reference
#include <concepts>
#include <type_traits>
#include "fixed.hpp"

Go to the source code of this file.

Classes

struct  is_fixed_point< fixed< Int, Frac, Raw > >
 Test if a type is fxd::fixed. More...
 
struct  is_signed_fixed_point< fixed< Int, Frac, Raw > >
 Test if a type is signed fxd::fixed. More...
 
struct  common_type< Fxd1, Fxd2 >
 Specialization: both are fxd::fixed, and either can be safely converted to the other. More...
 
struct  common_type< Fxd, Other >
 Specialization: fxd::fixed + arithmetic = fxd::fixed More...
 
struct  common_type< Other, Fxd >
 Specialization: arithmetic + fxd::fixed = fxd::fixed More...
 

Namespaces

namespace  fxd
 This is the namespace where the entire library is defined.
 

Variables

template<typename T >
constexpr bool is_fixed_point_v = is_fixed_point<T>::value
 Helper template variable for fxd::is_fixed_point
 
template<typename T >
constexpr bool is_signed_fixed_point_v = is_signed_fixed_point<T>::value
 Helper template variable for fxd::is_signed_fixed_point
 

Class Documentation

◆ common_type< Fxd1, Fxd2 >

struct common_type< Fxd1, Fxd2 >
template<typename Fxd1, typename Fxd2>
requires (fxd::is_fixed_point_v<Fxd1> && fxd::is_fixed_point_v<Fxd2> && (is_convertible_v<Fxd1, Fxd2> || is_convertible_v<Fxd2, Fxd1>))
struct common_type< Fxd1, Fxd2 >

Specialization: both are fxd::fixed, and either can be safely converted to the other.

Definition at line 105 of file traits.hpp.

Class Members
typedef conditional_t< is_convertible_v< Fxd2, Fxd1 >, Fxd1, Fxd2 > type

◆ common_type< Fxd, Other >

struct common_type< Fxd, Other >
template<typename Fxd, typename Other>
requires (fxd::is_fixed_point_v<Fxd> && is_arithmetic_v<Other>)
struct common_type< Fxd, Other >

Specialization: fxd::fixed + arithmetic = fxd::fixed

Definition at line 118 of file traits.hpp.

◆ common_type< Other, Fxd >

struct common_type< Other, Fxd >
template<typename Other, typename Fxd>
requires (is_arithmetic_v<Other> && fxd::is_fixed_point_v<Fxd>)
struct common_type< Other, Fxd >

Specialization: arithmetic + fxd::fixed = fxd::fixed

Definition at line 129 of file traits.hpp.