相关疑难解决方法(0)

可以在没有typedef的情况下访问模板外的模板参数吗?

一个简单的例子:

template<typename _X> // this template parameter should be usable outside!
struct Small {
   typedef _X X; // this is tedious!
   X foo;
};

template<typename SomeSmall>
struct Big {
   typedef typename SomeSmall::X X; // want to use X here!
   SomeSmall bar;
   X toe;
};
Run Code Online (Sandbox Code Playgroud)

有没有办法在不使用类中的typedef XSmall情况下访问模板参数Small

c++ templates metaprogramming introspection

9
推荐指数
2
解决办法
2784
查看次数

标签 统计

c++ ×1

introspection ×1

metaprogramming ×1

templates ×1