Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
如何检查模板类型是否是变体类型的类型之一?
考虑到变体类型和模板函数 如何检查模板类型是否是变体的类型之一 还有比下面更优雅的方式吗 typedef boost variant
c
boost
typetraits
c98
boostvariant
在 C++ 中推导两个类的共享基数
我几乎可以肯定 如果没有的话 我正在寻找的东西就无法完成反射 这还没有出现在语言中 但有时我会对 SO 中的特殊答案感到惊讶 所以让我们尝试一下 是否可以推导出具有公共共享基类的两种类型的 common base 因此以下内容是可能的 伪代
c
typetraits
cexperimental
如何判断两个类模板是否相同
假设我有一个具有两个模板模板参数的函数 例如 template
c
templates
typetraits
templatetemplates
我们需要 std::as_const() 做什么?
C 11给了我们std add const https en cppreference com w cpp types add cv 对于 C 17 我们有一个新的结构 std as const https en cppreference
c
constants
C17
typetraits
函数模板:具有类型特征的不同专业化
考虑到类模板 可以使用类型特征和虚拟启用模板参数为某些类型的组提供模板专业化 我已经早些时候问过 https stackoverflow com questions 12161033 partial template specializat
c
templates
typetraits
functiontemplates
C++ 编译时一个类的子类列表
我正在考虑如何创建从模板基类派生的所有类的列表 首先我想要一个模板基类 template
c
templates
Compilation
metaprogramming
typetraits
编译器如何处理编译时分支?
EDIT 我以 if else 情况为例 有时可以在编译时解决 例如 当涉及静态值时 参见
c
templates
ifstatement
C11
typetraits
如何使用 SFINAE 的 std::enable_if_t 和 std::is_base_of 检查编译时继承?
我试图在编译时将函数的模板类型限制为特定类及其子类 为了实现这一点 我使用了类型特征std enable if t and std is base of像这样 template
templates
c14
sfinae
typetraits
为什么 VC2015RC 下 `is_constructible
, int(*)(int,int)>::value` 为 true
include
c
C11
visualc
typetraits
stdfunction
可选未初始化的类: std::is_trivially_constructible 对于非默认构造函数似乎不正确?
我感到std is trivially constructible
c
initialization
typetraits
“函数模板已被定义”,具有互斥的 `enable_if`
对于以下代码 MSVC 会产生错误 函数模板已被定义 template
c
templates
sfinae
typetraits
enableif
std::enable_if 选择类别专业化
我试图理解std enable if以及使用它的好处static assert regular template specialitzation 阅读周围后我发现 当不满足特定条件时 这对于在编译时隐藏签名很有用 因为在这种情况下 将不会定
c
templates
typetraits
enableif
c++ static_assert 在“if constexpr 语句”的两个分支上均失败
我试图在编译时确定特定类型是否属于类型标准 对 当我编译下面的代码时 两个分支 即 HERE1 和 HERE2 上的断言均失败 如果我删除 static asserts 并取消注释打印 我会得到我所期望的 这是 HERE1 的is pair
c
C17
typetraits
staticassert
compiletimetypechecking
有没有办法防止使用静态断言和类型特征两次派生类?
我意识到这是一个人为的示例 但我想要进行编译检查以防止这种情况 class A class B public A class C public A class D public B public C BOOST STATIC ASSERT
c
multipleinheritance
typetraits
staticassert
检查可变参数模板中没有重复类型的 C++ 概念
我试图弄清楚如何编写一个概念来检查可变参数模板中没有重复的类型 我知道我不能在其内部递归地调用一个概念 但如果可以的话 我的解决方案将如下所示 忽略缺乏停止条件 include
c
C20
variadictemplates
typetraits
cconcepts
匹配可迭代类型(带有 begin()/end() 的数组和类)[重复]
这个问题在这里已经有答案了 我编写了类型特征 例如可以用来测试给定类型是否 可迭代 的类 这对于数组来说是正确的 对于T N 不是为了T 并且对于具有begin and an end返回看起来像迭代器的东西的方法 我想知道是否可以比我做的更
c
templates
typetraits
c14
检查成员是否存在,可能在基类中,C++11 版本
In https stackoverflow com a 1967183 134841 提供了一个解决方案用于静态检查成员是否存在 可能在类型的子类中 template
c
C11
final
templatemetaprogramming
typetraits
是否可以创建一个特征来回答类型是否来自 std?
After 这个问题通过利用 ADL 我们可以创建一个特征来回答传递的类型是否来自我们的命名空间 include
c
C11
templates
typetraits
argumentdependentlookup
删除某个类型的所有指针的标准 c++11 方法
有没有办法用一些 c 11 或最多一个 boost 库来做到这一点 include
c
boost
C11
typetraits
如何编写一个特征来检查类型是否可迭代
有没有办法检查任意变量类型是否可迭代 那么要检查它是否有索引元素或者我实际上可以循环它的子元素吗 例如使用 foreach 是否可以为此创建一个通用模板 我在搜索时发现了其他编程语言的技术 但仍然需要找出如何在 C 中做到这一点 您可以为此
c
templates
typetraits
iterable
«
1
2
3
4
5
»