相关疑难解决方法(0)

带有附加可选模板参数的标准库容器?

在文章中多次阅读索赔 - 我想将此问题添加到Stackoverflow,并询问社区 - 以下代码是否可移植?

template<template<typename T, typename Alloc> class C>
void f() {
  /* some code goes here ... */
}

int main() {
  f<std::vector>();
}
Run Code Online (Sandbox Code Playgroud)

供应的实施是否std::vector真的允许有两个众所周知的额外的,默认的模板参数?这会使上面的代码格式错误,因为它假设有两个模板参数.见最后一段在这篇文章中对这种要求的一个例子.

c++ parameters standards templates stl

25
推荐指数
1
解决办法
1325
查看次数

标签 统计

c++ ×1

parameters ×1

standards ×1

stl ×1

templates ×1