Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
部分模板专业化仅限于某些类型
是否可以编写仅用于类类型的部分模板专业化 例如 从特定类继承或遵守可以通过类型特征表达的某些其他约束 即 像这样 class A class B public A template
c
templates
templatespecialization
typetraits
std::is_trivially_copyable - 为什么易失性标量类型不可简单复制?
C 17 的当前标准 我观察到 C 11 的类似措辞 对于普通可复制类型的措辞非常混乱 我首先使用以下代码 GCC 5 3 0 偶然发现了这个问题 class TrivialClass std is trivially copyable
c
C11
standards
volatile
typetraits
类型特征的 _t 别名和 _v 变量模板的目的是什么?
有a lot of v and t后缀 例如std is same v std invoke result t result of t以及数百万个其他此类功能 Why它们到底存在吗 在任何情况下公开实施细节 例如std result of
c
C17
c14
languagedesign
typetraits
invoke_result获取模板成员函数的返回类型
如何获取模板成员函数的结果类型 下面的最小示例说明了该问题 include
c
templates
typetraits
invokeresult
获取类中的字段数
有没有办法获取一个类的字段数量 struct Base char a int b struct Derived Base std string c static assert num fields value 2 static assert
c
C11
templates
templatemetaprogramming
typetraits
在编译时检测 typedef(模板元编程)
我目前正在做一些模板元编程 就我而言 我可以处理任何 可迭代 类型 即任何类型typedef foo const iterator以同样的方式存在 我试图为此使用新的 C 11 模板元编程 但是我找不到检测某种类型是否丢失的方法 因为我还需
c
C11
sfinae
templatemetaprogramming
typetraits
C++ 中可重用的成员函数
我正在使用这个成员函数来获取指向对象的指针 virtual Object Create return new Object 它是虚拟的 所以我可以获得指向派生对象的指针 现在我这样做 virtual Object Create return
c
visualc
C17
typetraits
类型特征与静态成员相比的优点?
我有一堂课 Voxel 其子类可能具有也可能不具有许多不同的属性 材料 密度等 以及 get 和 set 方法 现在 我想编写一些代码 如下所示 template
c
typetraits
GCC:'std::is_same_v
' 在常量表达式中不可用
尝试实施下面的代码 https godbolt org z zPMae4 template
c
C20
typetraits
cconcepts
如何判断一个类型是否真正可移动构造
以这段代码为例 include
c
STL
movesemantics
typetraits
标准库中聚合可初始化性的类型特征?
C 标准库有std is constructible
c
C17
typetraits
aggregateinitialization
std::is_same
::value 总是 true 吗?
我继承了一些如下所示的代码 A specializable function for converting a user defined object to a string value template
c
C11
templates
typetraits
staticassert
使用概念或 SFINAE 检查类是否具有带 std::array 参数的模板化成员函数
介绍 我想使用概念和 或类型特征来检测类是否具有带有 std array 参数的成员函数 例如 下面的课程将传递这个概念 class OStreamRealizationGood template
c
Arrays
metaprogramming
typetraits
cconcepts
将相同的运算符专门用于不同的特征
我想通过特征进行专业化来执行以下操作 Array Aa Scalar in a会使用overload I Array Aa Array Bb会使用overload II 在下面的代码中 overload II永远不会习惯 有人提到过T1不能
c
c14
templatespecialization
typetraits
模板函数只匹配某些类型?
我想定义一个函数模板 template
c
templates
typetraits
使用 Detected Idiom 实现 is_destructible
这是我的实现is destructible v https en cppreference com w cpp types is destructible template
c
languagelawyer
C17
templatemetaprogramming
typetraits
用户定义类型的 std::common_type 特征
自 C 11 起 类型特征std common type被介绍了 std common type确定其所有模板参数之间的公共类型 在 C 14 中它的辅助类型std common type t还被引入是为了制作使用的代码std common
c
templates
C11
c14
typetraits
std::is_constructible 在具有非公共析构函数的类型上
预期结果是什么std is constructible http en cppreference com w cpp types is constructible在具有私有或受保护析构函数的类型上 例如 我仍然可以在堆上构造这样的对象 即使
c
C11
languagelawyer
typetraits
Eric Niebler 的 std::is_function 实现是如何工作的?
上周埃里克 尼伯勒tweeted https twitter com ericniebler status 852192542653329408一个非常紧凑的实现std is function http en cppreference co
c
C11
templates
c14
typetraits
对于 common_type,T declval() 而不是 T && declval()
使用不是更好吗std declval声明形式 template lt class T gt T declval 1 然后是当前的 template lt class T gt T declval 2 for std common type
c
C11
c14
typetraits
C17
1
2
3
4
»