The title is rather hard to formulate in word, but here is what I\'m trying to achieve in non-compileable code:
template class Conta
A template template parameter with typename...
template template parameter list will bind to any template name, regardless of the actual template parameter count. You can use this and speculatively assume the template to be instantiable with a single parameter.
template class Container>
Container foo() {
return Container{1,2,3};
}
int main() {
auto bar = foo();
return 0;
}
This works since C++-11
as far as I know.
It would also be possible to declare a templated alias with a single parameter, making the interface more self-documenting
template class Container>
Container foo() {
return Container{1,2,3};
}
template using vector_container = std::vector;
int main() {
auto bar = foo();
return 0;
}