Honeycomb  0.1
Component-Model Framework
Classes | Typedefs | Functions
honey::mt Namespace Reference

Meta-programming and compile-time util. More...

Classes

struct  conditional_int
 Variant of std::conditional for integers, stores result in value More...
 
struct  conditional_int< true, t, f >
 
struct  elemOf
 Get range element type. More...
 
struct  Funcptr
 
struct  Funcptr< R(Args...)>
 Holds a function pointer so that a functor can be called non-virtually. The functor must inherit from FuncptrBase. More...
 
struct  Funcptr< void(Args...)>
 Specialization for void return type. More...
 
struct  FuncptrBase
 Inherit to enable non-virtual functor calling. More...
 
class  funcTraits
 Get function type traits. More...
 
struct  gcd
 Calc greatest common divisor of a and b. More...
 
struct  gcd< 0, b >
 
struct  gcd< a, 0 >
 
struct  identity
 Returns type T unchanged. More...
 
struct  is_base_of
 Version of std::is_base_of that removes reference qualifiers before testing. More...
 
class  isCallable
 Check if functor is callable with arguments. More...
 
class  isRange
 Check if type is a range or a reference to one. A range is a type where std::begin(range) is a valid call. More...
 
struct  isSpecializationOf
 Check if T is a specialization of Template. More...
 
struct  isSpecializationOf< Template< Param... >, Template >
 
struct  iter_endOf
 Get range iterator end type. More...
 
struct  iterOf
 Get range iterator begin type. More...
 
struct  log2Floor
 Calc log base 2 of unsigned integer, rounded down to nearest integer. Returns -1 if x is zero. More...
 
struct  log2Floor< 0 >
 
class  max
 Get maximum of all arguments. More...
 
struct  max< val >
 
struct  max< val, vals... >
 
class  min
 Get minimum of all arguments. More...
 
struct  min< val >
 
struct  min< val, vals... >
 
struct  NoCopy
 Inherit to declare that class is not copyable. More...
 
struct  tag
 Use to differentiate an overloaded function by type. Accepts dummy parameter default value: func(tag<0> = 0) More...
 
struct  True
 Always returns true. Can be used to force a clause to be type dependent. More...
 
struct  True_int
 Variant of True for integers. More...
 
struct  Void
 Special void type, use where void is intended but implicit members are required (default ctor, copyable, etc.) More...
 

Typedefs

template<class T , T val>
using Value = std::integral_constant< T, val >
 Holds a constant integral value. More...
 
template<class T >
using isTrue = Value< bool, std::is_same< T, std::true_type >::value >
 Check if type is std::true_type. More...
 
template<class T >
using addRef = std::add_lvalue_reference< T >
 Add reference to type. More...
 
template<class T >
using removeRef = std::remove_reference< T >
 Remove reference from type. More...
 
template<class T >
using addPtr = std::add_pointer< T >
 Add pointer to type. More...
 
template<class T >
using removePtr = std::remove_pointer< T >
 Remove pointer from type. More...
 
template<class T >
using addConstRef = addRef< typename std::add_const< T >::type >
 Add top-level const qualifier and reference to type. Use std::decay to remove top-level const/ref. More...
 
template<class T >
using isLref = Value< bool, std::is_lvalue_reference< T >::value >
 Check if type is an lvalue reference. More...
 
template<class T >
using isRref = Value< bool, std::is_rvalue_reference< T >::value >
 Check if type is an rvalue reference. More...
 
template<class T >
using isRef = Value< bool, std::is_reference< T >::value >
 Check if type is a reference. More...
 
template<class T >
using isPtr = Value< bool, std::is_pointer< T >::value >
 Check if type is a pointer. More...
 
template<bool b, class T = void>
using disable_if = std::enable_if<!b, T >
 Opposite of std::enable_if. More...
 
template<class T >
using isTuple = isSpecializationOf< typename std::decay< T >::type, tuple >
 Check if type is a tuple or a reference to one. More...
 
template<int I, class... Ts>
using typeAt = typename priv::typeAt< 0, I, Ts... >::type
 Get type at index of parameter pack. More...
 
template<class Match , class... Ts>
using typeIndex = priv::typeIndex< 0, Match, Ts... >
 Get index of first matching type in parameter pack, returns -1 if not found. More...
 
template<szt... Ints>
using idxseq = std::index_sequence< Ints... >
 Shorthand for std::index_sequence. More...
 
template<szt N>
using make_idxseq = std::make_index_sequence< N >
 Shorthand for std::make_index_sequence. More...
 
template<class Array >
using arraySize = Value< szt, sizeof(Array)/sizeof(typename Array::value_type)>
 Get size (number of elements) of a std::array. More...
 
template<class T >
using isIterator = priv::isIterator< typename removeRef< T >::type >
 Check if type is an iterator or a reference to one. An iterator is a type that has member iterator_category or is a pointer. More...
 
template<int64 val>
using abs = Value< int64,(val< 0)?-val:val >
 Get the absolute value of a number. More...
 
template<int64 val>
using sign = Value< int64,(val< 0)?-1:1 >
 Get the sign of a number. More...
 

Functions

template<class... Args>
void pass (Args...)
 Do nothing, can be used to evaluate an unpack expression. More...
 
template<class Func , class Tuple >
auto applyTuple (Func &&f, Tuple &&t)
 Call a function with arguments from an unpacked tuple. ie. f(get<Indices>(t)...) More...
 
template<class T , class... Ts>
auto make_array (T &&t, Ts &&...ts) -> array< T, sizeof...(Ts)+1 >
 Create an array of deduced type initialized with values. More...
 
void exec ()
 
template<class Func , class... Funcs>
void exec (Func &&f, Funcs &&...fs)
 Execute a list of functions. Use to expand parameter packs in arbitrary statements: exec([&]() { accum += get<Seq>(tuple); }...). More...
 
template<int64 begin, int64 end, int64 step = 1, class Func , class... Args, typename std::enable_if< begin==end, int >::type = 0>
void for_ (Func &&f, Args &&...args)
 Unroll a loop calling f(counter, args...) at each iteration. More...
 
template<class F , class Sig = typename funcTraits<typename removeRef<F>::type>::Sig>
Funcptr< Sig > FuncptrCreate (F &&f)
 Convenient method to create a Funcptr from a functor that inherits from FuncptrBase. More...
 
template<class Result = void, class... Ts>
std::conditional< std::is_same< Result, void >::value, mt::typeAt< 0, Ts... >, Result >::type valAt (int i, Ts &&...ts)
 Get value at index of parameter pack. All types must be convertible to Result, which defaults to the first type in Ts. More...
 
template<class Val , class... Ts>
int valIndex (Val &&val, Ts &&...ts)
 Get index of first matching value in parameter pack, returns -1 if not found. More...
 

Detailed Description

Meta-programming and compile-time util.

Function Documentation

template<class Result = void, class... Ts>
std::conditional<std::is_same<Result, void>::value, mt::typeAt<0, Ts...>, Result>::type honey::mt::valAt ( int  i,
Ts &&...  ts 
)

Get value at index of parameter pack. All types must be convertible to Result, which defaults to the first type in Ts.

template<class Val , class... Ts>
int honey::mt::valIndex ( Val &&  val,
Ts &&...  ts 
)

Get index of first matching value in parameter pack, returns -1 if not found.