Pab*_*ube 5 c++ inheritance templates c++11
我正在尝试为模板化类实现 std::is_base_of 的扩展,如果我有以下内容:
template <typename X, typename Y, int Z> class A {};
template <typename X> class B : public A<X, char, 2> {};
Run Code Online (Sandbox Code Playgroud)
我可以使用类似的东西
std::is_base_of_ext<A, B<int>>
Run Code Online (Sandbox Code Playgroud)
静态检查 An 是否是来自 B 的基类,独立于特定的模板参数和 B 从 A 特化的方式。
“ std::is_base_of for template classes ”为此提供了一个非常好的解决方案,但它仅适用于类型模板参数;它也可以用于非类型参数吗?
| 归档时间: |
|
| 查看次数: |
140 次 |
| 最近记录: |