namespace traits

Summary

Members Descriptions
Traitfunction_traits Extract basic information from a functor like out type, arg type, arity...
Traitis_vector Is vector template trait
Traitis_base_of_template Is base of template base trait.

Trait function_traits

Extracts basic information from a functor like out type, arg type, arity...

template <typename T> struct function_traits : public function_traits<decltype(&T::operator())> {};
// For generic types, directly use the result of the signature of its 'operator()'
template <typename ClassType, typename ReturnType, typename... Args>
struct function_traits<ReturnType (ClassType::*)(Args...) const>
    // we specialize for pointers to member function
    {
  enum {
    arity = sizeof...(Args)
  };
  // arity is the number of arguments.

  template <int i> using arg = typename std::tuple_element<i, std::tuple<Args...>>::type;

  typedef ReturnType result_type;
};

Trait is_vector

Trait that checks if the given type is a vector.

template <typename T, typename _ = void> struct is_vector {
  static const bool value;
};

Trait is_base_of_template

Checks whether C is base of T

template <typename T, template <typename...> class C>
using is_base_of_template = decltype(is_base_of_template_impl<C>(std::declval<T*>()))