Access typedefs of template class without template parameters?

Hi

I have something like the below code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>

using namespace std;

template <typename T>
class Something
{
    private:
    
    public:
        using BigNum = unsigned int;
};

int main()
{
   struct MyStruct{};
   Something<MyStruct>::BigNum x; // Can only use the 'typedef' if template parameter specified

   Something::BigNum x; // doesn't work
   
   return 0;
}


Having to specify the template parameter is a bit ugly. Is there any way to avoid this (other than putting the typedef outside the class)?

Thanks
Last edited on
Something I like to do especially if the template arguments are complicated is to provide a typedef as an alias.

Using your example:
1
2
3
  typedef Something<MyStruct> mydef;
//
  mydef::BigNum x;

Topic archived. No new replies allowed.