Templates are wonderful idea, but if I need to make a template with partially defined parameters, this becomes problematic, requireing that an intermediate class is made with a template in it. Because the template then becomes a dependent type, we then have to declare the word template before it's name if you pass it, which is ugly and sometimes difficult to track down what is wrong when you get the syntax incorrect.
Complete template aliasing is available in the language like this:
template <typename FROM, typename TO>
using my_is_convertable = std::is_convertable<FROM, TO>;
I propose that partial template aliasing also be allowed, which would allow the template be broken up in to 2 or more sub-templates.
For example, say I have a find meta-algorithm, which will have a value that is true if any of OP<Ts>::value... are true or false otherwise. I will only declare it here for brevity.
template <typename <typename> class OP, typename...Ts>
struct find;
It is defined as a unary template operator to apply the DRY principal. Now if I want to use this on a binary template operator, then I would need to bind the parameter. If known ahead of time, it would become:
template <typename TO>
using my_is_convertable = std::is_convertable<int, TO>;
and would be used like so:
find<my_is_convertable, float, int, double>::value
However, if it's not known ahead of time what to bind the parameter to I would have to use an class template with a embded template alias in it like this:
template <typename FROM>
struct my_is_convertable
{
template <typename TO>
using ttype = std::is_convertable<FROM, TO>;
};
And use it like this:
find<my_is_convertable<int>::template ttype, float, int double>::value
I propose that instead we use this syntax to define partial template aliasing:
template <typename TO>
template <typename FROM>
using is_convertable = std::is_convertable<TO, FROM>;
find<my_is_convertable<int>, float, int double>::value
This would also make this valid:
my_is_convertable<int><int>::value
Which should be fine.
Pros:
Verbosity is lowered, no more need for referring to an embedded template is required which follows that the need for the template keyword is also removed, all of which reducing noise. Also it would not break anything in the wild. This would also mostly remove the need for tbind, except in cases where symbol leakage is not wanted in the enclosing scope.
Cons:
Developers would need to get used to the syntax. Nothing too crazy though.
What is everyone's opinion on this?