Closed
Description
Recently cppfront added the ability to define user-defined types. I want to extend this feature to be able to declare type aliases. My proposed syntax looks like this:
DWORD: type = u32;
// templated type aliases
MyPair: <T> type = std::pair<T, T>;
// nested aliases work too
MyVector: <T> type = {
size_type: type = std::size_t;
}
This will be compiled to (skipping boilerplate):
using DWORD = cpp2::u32;
template<typename T> using MyPair = std::pair<T,T>;
template <typename T> class MyVector {
public: using size_type = std::size_t;
};
Will your feature suggestion eliminate X% of security vulnerabilities of a given kind in current C++ code?
No.
Will your feature suggestion automate or eliminate X% of current C++ guidance literature?
Yes, this syntax uses the l-to-r declaration syntax already used widely in Cpp2, so there's no need to teach the syntax
using alias_name = type_name
.
I have already implemented this feature locally so I can provide a PR.