c++ - C++ 中具有类模板参数的类模板的别名
问题描述
我工作,C++17
我需要创建一个这样的别名:
template<const unsigned int x>
using AnotherClass_MyClass3 = MyClass<AnotherClass<x>, 3>;
以便稍后在代码中我可以调用:
AnotherClass_MyClass3(arg); // calls the constructor
但我收到以下错误:
test.cpp:1563:13: error: alias template 'AnotherClass_MyClass3' requires template arguments; argument deduction only allowed for class templates
我该如何克服呢?
所有这一切都是因为我需要编写一个部分专门化来MyClass
操作AnotherClass
实例,但后者也是一个模板。
对不起,如果这是微不足道的,我是 C++ 的相对初学者。
解决方案
推荐阅读
- ios - 导航项标题视图在 iPhone 8 上出现两次
- javascript - Web Audio API 无法在 iOS 13.3 版上播放。适用于旧版本的 iOS
- rx-java - 如何在 RxJava 中获得布尔组合运算符的“短路”行为
- karate - 空手道:包含功能
- c# - JSON 值无法转换为 System.DateTime
- postgresql - 合并到“合并”时出错的语句
- vue.js - npm run server 抛出错误 sh: 1: vue-cli-service: not found
- java - 杰克逊反序列化与特定的反序列化播放框架 2.8
- javascript - 显示循环遍历对象数组的键值对
- sql - 在 SQL 中一次在多行中插入相同的 MAX 值?