templates can be use with:
TBA
Substitution Failure Is Not An Error - if template substitution fails, the compiler tries other overloads instead of erroring. Used historically for type-trait-based overload selection. Modern alternative (C++20): concepts and requires clauses, which are clearer and produce better error messages.
usage: decltype(var)
decltype(std::declval<type>().<member var/func>)
pass a template as param to another template
C++ compiler only ensures the template matches the number of arguments in signature…
template<**template<typename, typename>** typename T, typename U>
class Test {
};
for functions, instead of writing template keyword, we can use auto to create function template
auto func(auto a, auto b);
auto func(auto a, decltype(a) b) -> decltype(...); # enforce same type...
# constrained auto with concept
# can also with return type!
concept_type auto func(concept_type auto a);