Classes | Namespaces | Macros | Typedefs | Functions
type_promotion.h File Reference
#include <limits>
#include <type_traits>
#include "ecvl/core/datatype.h"

Go to the source code of this file.

Classes

struct  ecvl::larger_arithmetic_type< T, U >
 
struct  ecvl::arithmetic_superior_type< T, U >
 
struct  ecvl::promote_superior_type< T, U >
 

Namespaces

 ecvl
 

Macros

#define PROMOTE_OPERATION(op_name, op_symbol)
 

Typedefs

template<typename T , typename U >
using ecvl::larger_arithmetic_type_t = typename larger_arithmetic_type< T, U >::type
 
template<typename T , typename U >
using ecvl::arithmetic_superior_type_t = typename arithmetic_superior_type< T, U >::type
 
template<typename T , typename U >
using ecvl::promote_superior_type_t = typename promote_superior_type< T, U >::type
 
template<DataType DT, DataType DU>
using ecvl::promote_superior_type_dt = promote_superior_type_t< TypeInfo_t< DT >, TypeInfo_t< DU > >
 

Functions

template<typename T , typename U >
promote_superior_type_t< T, U > ecvl::PromoteAdd (T lhs, U rhs)
 
template<typename T , typename U >
promote_superior_type_t< T, U > ecvl::PromoteSub (T lhs, U rhs)
 
template<typename T , typename U >
promote_superior_type_t< T, U > ecvl::PromoteMul (T lhs, U rhs)
 
template<typename T , typename U >
promote_superior_type_t< T, U > ecvl::PromoteDiv (T lhs, U rhs)
 

Macro Definition Documentation

◆ PROMOTE_OPERATION

#define PROMOTE_OPERATION (   op_name,
  op_symbol 
)
Value:
template<typename T, typename U> \
promote_superior_type_t<T, U> Promote ## op_name(T lhs, U rhs) { \
using dsttype = promote_superior_type_t<T, U>; \
return static_cast<dsttype>(lhs) op_symbol static_cast<dsttype>(rhs); \
}

Definition at line 66 of file type_promotion.h.