DSC Engine
Loading...
Searching...
No Matches
Typedefs | Functions
templates.hpp File Reference

type template definitions More...

Go to the source code of this file.

Typedefs

template<bool B, typename T , typename F >
using DSC::_if_ = typename __if__< B, T, F >::type
 Decides type based on a boolean expression. More...
 
template<typename T >
using DSC::_no_ref_ = typename __no_ref__< T >::type
 gets rid of type reference More...
 
template<unsigned int C>
using DSC::uint_best_fit = _if_< C< 256, unsigned char, _if_< C< 65536, unsigned short, unsigned int > >
 Chooses the smallest unsigned integer type that fits a constant. More...
 

Functions

template<class T >
_no_ref_< T > && DSC::_move_ (T &&arg)
 Creates rvalue reference from object (useful in move semantics) More...
 
template<class T >
_no_ref_< T > && DSC::_move_ (T &arg)
 
template<typename T >
constexpr const T & DSC::min (const T &first, const T &second)
 
template<typename T , typename... Arguments>
constexpr const T & DSC::min (const T &first, const Arguments &...args)
 
template<typename T >
constexpr const T & DSC::max (const T &first, const T &second)
 
template<typename T , typename... Arguments>
constexpr const T & DSC::max (const T &first, const Arguments &...args)
 
template<typename T >
constexpr void DSC::swap (T &first, T &second)
 

Detailed Description

type template definitions

Typedef Documentation

◆ _if_

template<bool B, typename T , typename F >
using DSC::_if_ = typedef typename __if__<B,T,F>::type

Decides type based on a boolean expression.

Template Parameters
Bboolean expression
Ttype if B is true
Ftype if B is false

if B is true, then _if_<B,T,F> evaluates to T, otherwise it evaluates to F

Equivalent of std::conditional

_if_< (2>3), int, short > x; // <=> short x;

◆ _no_ref_

template<typename T >
using DSC::_no_ref_ = typedef typename __no_ref__<T>::type

gets rid of type reference

Equivalent of std::remove_reference

_no_ref_<int> x; // <=> int x;
_no_ref_<int&> x; // <=> int x;
_no_ref_<int&&> x; // <=> int x;

◆ uint_best_fit

template<unsigned int C>
using DSC::uint_best_fit = typedef _if_< C<256, unsigned char, _if_<C<65536, unsigned short, unsigned int> >

Chooses the smallest unsigned integer type that fits a constant.

Template Parameters
Can unsigned constant
  • if 0<=C<256, then uint_best_fit<C> is 8-bit
  • if 256<=C<65536, then uint_best_fit<C> is 16-bit
  • if 65536<=C, then uint_best_fit<C> is 32-bit

Function Documentation

◆ _move_()

template<class T >
_no_ref_< T > && DSC::_move_ ( T &&  arg)

Creates rvalue reference from object (useful in move semantics)

Parameters
[in]argthe target object
Returns
rvalue reference (&&) to object

Equivalent of std::move