I would like to deduce a class' (with default template parameter) typedef with c++17 automatically. Does somebody know if this is possible? The following code tries to illustrate this:
#include <vector>
template <typename T = int>
struct A{
using Vec = std::vector<T>;
};
int main() {
A a{}; // works with c++ 17
A<int>::Vec vec2{}; //works
A::Vec vec{}; //does not seem to work with c++ 17. Is that possible somehow?
}
In the code above, a is instantiated without problems, and the deduced template type is int as per default. Nevertheless, I have to pass the parameter type to use the typedef Vec. I would be very grateful if somebody knew an answer to the two following questions:
- What is the paper number/title of the ISO mailing list for the feature allowing automatic type deduction for
A a{}? I am curious to learn more about this feature. - Is it possible to infer the type of
Vecautomatically without specifying the template type ofAexplicitly?
I am grateful for any hints or suggestions!