YAKOVM
YAKOVM

Reputation: 10153

Alias to complicated Template Typename

I have the following definition in file Segment.h

template<typename T, typename VecType = mat::vec3_gen<T> > class Segment
{
    // class
}

Instead of having typename VecType = mat::vec3_gen<T> I want to use some alias for the type and be able to use it outside the file also. how can I do it?

Upvotes: 1

Views: 64

Answers (1)

Guillaume Racicot
Guillaume Racicot

Reputation: 41770

Since the type VecType depends on T, you can make the type alias a member of Segment.

template<typename T>
class Segment {
public:
    using VecType = mat::vec3_gen<T>;
};

Now you can use it in other code:

auto vec = Segment<int>::VecType;

Upvotes: 4

Related Questions