user5365696
user5365696

Reputation: 11

Typedef a member type of a template

I have a formulation like this:

template <typename A, typename B>
struct SomeLibraryClass
{
     using Foo = A;
     using Bar = B;
};

Now I want to use it but rename it since conceptually the usage is different.

template <typename A, typename B>
using quaz = SomeLibraryClass<A, B>;

However, if I want to get bar, it's still quaz::bar. But say I want quaz::bar to be quaz::foobar instead. Is this possible? Why or why not?

I cannot use inheritance. It silently breaks the code.

Upvotes: 1

Views: 77

Answers (1)

Brian Bi
Brian Bi

Reputation: 119164

You cannot add or remove members, or change the name of a member of a class that is already defined. All you can do is define a new class.

Upvotes: 1

Related Questions