tinympl
0.2
mini MPL library for C++11
|
Produce a template type by binding the given arguments on the passed template template. More...
#include <tinympl/bind.hpp>
Produce a template type by binding the given arguments on the passed template template.
tinympl::bind
is the compile time equivalent of std::bind
. It produces a new template type bind<...>::template eval
which invokes the given one (F
) with some of its arguments bound to Args
. Notice that in C++11 the effect of bind can be achieved with template aliases. In order to produce a cleaner code, we recommend to use template aliases wherever is possible, and use bind
only when necessary.
bind< std::is_same, arg1, U>::template eval
is equivalent to template<class T> using is_same1 = std::is_same<T,U>;
bind
also automatically recognize bind expressions in its subarguments, so it is possible to nest multiple bind calls:
bind< std::is_same, bind<std::remove_reference,arg1>, U>::template eval
is equivalent to template<class T> using is_same1 = std::is_same< typename std::remove_reference<T>::type, U>;