- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
A template-id is valid if
- there are at most as many arguments as there are parameters or a parameter is a template parameter pack ([temp.variadic]),
- there is an argument for each non-deducible non-pack parameter that does not have a default template-argument,
- each template-argument matches the corresponding template-parameter ([temp.arg]),
- substitution of each template argument into the following template parameters (if any) succeeds, and
- if the template-id is non-dependent, the associated constraints are satisfied as specified in the next paragraph.
A simple-template-id shall be valid unless it names a function template specialization ([temp.deduct]).
考虑以上代码,在这种情况下,第二个模板参数template<typename T, typename U>
struct Test{};
int main(){
using type = Test<int>;
}U
non-deducible
是吗?在标准中似乎没有正式的术语来解释什么是non-deducible
。non-deduced context
仅有一个定义,但是我认为它们不一样。那么我如何理解non-deducible
的用语呢?使用这样的措词(尚无正式定义)还不清楚吗?
题
Test<int>
是无效的模板ID,在上面的列表中它违反了哪个项目符号?
non-deducible
是指什么?
不参与模板参数推导的模板参数是否可以称为 non-deducible
?
最佳答案
这只是英文。 “可推论”是指“可以推论”。 C++有一个well-defined process for deducing template arguments。如果一个论点是“可推论的”,那么它是一个推论过程成功的论据,因此是“可以推论的”。
“不可推论”简单地表示“不可推论”。因此“无法推论”。因此,此模板参数推导过程失败。
因此,这就是说“每个非压缩参数都有一个参数,其参数不能通过模板推导过程推导”。没有什么不清楚的。
关于c++ - `non-deducible`的正式定义是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63045748/
[我已经编辑了这个问题,因为我简化了导致问题的示例] 我在使用 clang 3.9 的 Travis CI(dist:trusty)上收到以下错误: error: call to implicitly
我是 Haskell 的初学者,正在实现一些基本的代数,比如 class (Eq g) => AbelianGroup g where gplus :: g -> g -> g gne
来自这个问题: Using enum values in combination with SFINAE 我尝试实现: enum Specifier { One, Two, T
If P is a class and P has the form simple-template-id, then the transformed A can be a derived class
这是初学者的问题,但我无法在任何地方识别出任何答案。 以下代码: class A a where foo :: a class A a => B a where bar :: a bar
我正在写一个 Haskell 库,它使用 Data.Vector的。库函数写成功了,不知道怎么加签名。下面是一个说明问题的简单示例: 将合格的 Data.Vector.Generic 导入为 V --
我应该如何在 Deducer 的线性回归模型生成器中生成如下公式 lm(ozone~temp*wind*rad+I(rad^2)+I(temp^2)+I(wind^2)) 在 Outcomes文本框我
temp.names#6 A template-id is valid if there are at most as many arguments as there are parameters o
我有以下代码: class Coll c e where map :: (e1 -> e2) -> c e1 -> c e2 merge :: (e -> e -> e) -> e -
我偶然发现,为什么模板参数演绎在这里不起作用?最近,答案可以归结为“这是一个非演绎的背景”。。具体地说,第一个说是这样的事情,然后重定向到“细节”的标准,而第二个引用的标准,至少可以说是神秘的。。有人
我正在尝试创建另一个 Random 实例,但遇到了类型错误。我将其简化为以下 ghci session : GHCi, version 8.6.5: λ> import System.Random λ
我正在修改以下代码作为作业的一部分: rand :: Random a => State StdGen a rand = do gen (a, a) -> State StdGen a。我编
当我尝试编译这个时: module Main where import qualified Data.Vector.Unboxed.Mutable as MV import Control.Monad
我正试图完成我的一个学校项目,但我遇到了一个问题。我正在尝试在我的工作中使用模板,但似乎我并不真正了解该怎么做。这是我的代码的一部分: 主要.cpp #include "stdafx.h" #incl
这个问题不太可能帮助任何 future 的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况有关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visit
我正在做一些看起来像这样的包装器: #include template void Apply(void (T::*cb)(Value), T* obj, Value v) { (obj->*
我对 Haskell 的类型系统有以下问题:我试图声明一个数据类型并从函数返回一个包含该类型元素的列表。不幸的是,即使是最小的测试用例,例如 data SampleType = SampleTypeC
来 self 的 previous question ,我一直在尝试制定一些单子(monad)代码。首先,这是我正在使用的状态机函数: import Control.Monad import Cont
我在 .hs 文件中有以下代码 module TypeInference1 where f :: Num a => a -> a -> a f x y = x + y + 3 然后,如果我检查 的类型
这是一个非常简单的程序,我不知道我做错了什么。我在网上看过,但找不到任何有用的东西。我的 getline(cin, movieName) 有问题,但我不知道是什么。 //This program wi
我是一名优秀的程序员,十分优秀!