uvcc
libuv C++ bindings
Dealing with type lists and parameter packs

Classes

struct  uv::is_one_of< _T_, _Ts_ >
 Checks if a type _T_ belongs to a type list _Ts_. More...
 
struct  uv::is_convertible_to_one_of< _T_, _Ts_ >
 Checks if a type _T_ is convertible to one of the types from the type list _Ts_. More...
 
struct  uv::type_at< _index_, _Ts_ >
 Provides a typedef member type equal to the type from the type list _Ts_ at index _index_. The index should start from 1 up to sizeof...(_Ts_). More...
 

Functions

template<typename _T_ , typename... _Ts_>
constexpr auto uv::greatest (_T_ &&_v, _Ts_ &&... _vs) -> std::common_type_t< decltype(_v), decltype(_vs)... >
 Intended to be used instead of constexpr T max(std::initializer_list<T>)... More...
 
template<typename _T_ , typename... _Ts_>
constexpr auto uv::lowest (_T_ &&_v, _Ts_ &&... _vs) -> std::common_type_t< decltype(_v), decltype(_vs)... >
 The counterpart of greatest()
 
template<typename _T_ , typename... _Ts_>
constexpr auto uv::sum (_T_ &&_v, _Ts_ &&... _vs) -> std::common_type_t< _T_, _Ts_... >
 Primarily intended for summation of values from parameter packs if fold expressions are not supported.
 

Detailed Description

Function Documentation

◆ greatest()

template<typename _T_ , typename... _Ts_>
constexpr auto uv::greatest ( _T_ &&  _v,
_Ts_ &&...  _vs 
) -> std::common_type_t< decltype(_v), decltype(_vs)... >
inline

Intended to be used instead of constexpr T max(std::initializer_list<T>)...

...if the latter is not defined of being constexpr in the current STL version and therefore cannot be employed at compile-time. Does not require the arguments to be of the same type and using the std::initializer_list curly braces when there are more than two arguments.

While promoting to a common resulting type a temporary local value can be implicitly created by the compiler, therefore the function is not able to safely return a reference type result, or else the 'warning: returning reference to temporary' is generated in some use cases.

Definition at line 162 of file utility.hpp.