Let's say there is a class A and MyType
template<typename DataType>
class MyType {
...
}
template<typename MyType>
class A {
...
}
When I create an instance of A with A<MyType<int>> how can I access the template type int inside A?
Expose a type alias to the user:
template<typename DataType>
class MyType {
public:
    using InnerDataType = DataType;
};
template<typename MyType>
class A {
public:
    using InnerType = MyType;
};
Usage:
using MyA = A<MyType<int>>;
static_assert(std::is_same<
    typename MyA::InnerType::InnerDataType,
    int>{});
live example on wandbox
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With