泛型类中可能有更多"where"约束吗?
more "where" constraints in generic class is possible?
我有一个接口(因为我想不出一种方法来为我从DB查询调用中检索到的内容设置属性),它是这样定义的,
interface class IData
{
public:
void Set(int i);
int Get();
};
我有一个像这样定义的泛型类
generic<typename T, typename U> where T:IsomeInterface public ref class MyClass{};
我想在上面的MyClass声明中添加"where U:IData",但我现在卡住了。
这和c#一样。这样的:
generic<typename T, typename U>
where T:IData
where U:IData
public ref class MyClass {
};
. .等。
相关文章:
- 函数作为模板参数,是否对返回类型强制约束
- 约束和显式模板实例化
- IpOpt拒绝解决不受约束的问题
- 使用C++模板时表达约束
- 如何在 SCIP C++ 接口中获取 MILP 约束矩阵中的系数值
- 受约束的成员函数和显式模板实例化
- 具有多种约束(例如重量、体积等)的背包
- Where is std::hardware_destructive_interference_size?
- Gecode 与 Z3 用于约束随机化
- 如果原型是本地的,则使用流 I/O C++类型约束将失败
- C++打开具有 2 个约束的文件
- 如何拥有受约束的运算符模板?
- 不生成单独约束的变量的 Gurobi 影子价格
- 在 C++20 中对概念约束函数进行排序的规则是什么?
- 如何使用 g2o 优化多约束函数
- 约束类模板函数以接受特定的 POD 类型
- 约束包容是否仅适用于概念?
- 检查特定txt文件中的项目是否符合"名称编号USACO"中的约束
- 对类模板成员的显式专用化的约束
- 泛型类中可能有更多"where"约束吗?