Why does this fail to compile? I am trying to reduce the amount of repetition since in the real code the class name is huge and the type is actually a very long name
#include <vector>
template<typename T>
struct S {
using type = std::vector<T>;
type f() const;
};
template<typename T>
using type_t = typename S<T>::type;
template <typename T>
type_t<T> S<T>::f() const { }
The code above fails as below
<source>:17:14: error: no declaration matches 'type_t<T> S<T>::f() const'
17 | type_t < T > S < T >::f() const
| ^~~~~~~
<source>:8:10: note: candidate is: 'S<T>::type S<T>::f() const'
8 | type f() const
| ^
<source>:4:8: note: 'struct S<T>' defined here
4 | struct S
| ^