typedef Using a typename

Viewed 860

So I had some code that I asked a question about which I realized was confusing and later edited out:

template <typename T>
struct foo {
    typedef typename pair<T, T> PointType;
private:
    PointType point;
};

I'm not certain what the function of the typename in PointType's definition is. It this keyword just omitted? I notice that it's frequently used in the using definitions to add the *_t extensions in type support. Perhaps that's what was intended here?

2 Answers

It is necessary because pair<T, T> is a dependent name, meaning that it changes depending on how foo was initialized.

Related