Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
使用 std::conditional_t 延迟评估(短路)的通用方法
在处理编译时字符串时 变量列表char 操作 我需要实现一种方法来检查编译时字符串是否包含另一个 较小的 编译时字符串 这是我的第一次尝试 template
c
templates
c14
templatemetaprogramming
typetraits
给定一组类,调用具有匹配方法参数的类
我有两个或多个从单亲继承的类 他们都已经超载了handle方法 但每个类的句柄方法都有不同的参数 class CommandHandler class FooCommandHandler public CommandHandler publ
c
c14
在 lambda 中延迟初始化和缓存内部值的简洁方法
首先用简单的方法让代码自己说话 int heavy calc needed to be called once sleep 7500000 years return 42 int main auto foo And cached for l
c
Lambda
c14
如何在编译时生成嵌套循环
我有一个整数N我在编译时就知道了 我也有一个标准 数组保存描述形状的整数N维数组 我想在编译时使用元编程技术生成嵌套循环 如下所述 constexpr int N 4 constexpr std array
c
templates
C11
metaprogramming
c14
double 类型的静态类成员的常量表达式初始值设定项
在 C 11 和 C 14 中 为什么我需要constexpr在下面的代码片段中 class Foo static constexpr double X 0 75 而这会产生编译器错误 class Foo static const doub
c
C11
c14
staticmembers
constantexpression
C++ 非类型参数包扩展
我正在编写由单一类型参数化的模板函数 并且具有可变数量的相同类型 而不是不同类型 的参数 它应该检查第一个值是否在其余值中 我想这样写 include
c
templates
c14
variadictemplates
variadicfunctions
函数参数的生命周期是多少(需要引用)? [关闭]
Closed 这个问题需要细节或清晰度 help closed questions 目前不接受答案 函数参数的生命周期是否等于作为 右值 引用传递的未命名临时变量 等于调用该函数的表达式 我的 gcc 编译器表明确实如此 但我想看到一个实际
c
C11
standards
c14
来自用户定义文字的整数字符序列,以字符串作为参数
目前 只有双精度数可以在用户定义的文字中生成字符模板 template
c
templates
c14
templatemetaprogramming
userdefinedliterals
这个元组创建习惯有名字吗?
On the 增加邮件列表 http lists boost org Archives boost 2014 06 214213 php LouisDionne 最近发布了以下创建类似元组的实体的巧妙技巧 include
c
tuples
variadictemplates
c14
genericlambda
为什么模板类的静态成员不唯一
看一下下面的代码 include
c
templates
c14
staticmembers
将非算术类型作为参数传递给 cmath 函数是否有效?
给定以下用户定义类型S具有转换功能double struct S operator double return 1 0 以及以下调用cmath http en cppreference com w cpp header cmath使用类型的
c
C11
languagelawyer
c14
cmath
在 Visual Studio 2017 中变量模板中的除法返回零
这大概是一个视觉工作室2017 questions tagged visual studio 2017与此问题相关的错误 Visual Studio 中 Lambda 的模板变量错误 https stackoverflow com q 49
c
VisualStudio2017
c14
Division
variabletemplates
c++1y 模式下的 Clang >= 3.3 无法解析
标头
我有一个项目可以在 g 4 8 1 和 c 11 模式下 clang gt 3 3 下正确编译和运行 然而 当我切换到实验时 std c 1y模式下 clang 3 3 但不是 g 在
c
C11
header
Clang
c14
如何用模板参数包的内容填充数组?
我嵌套了与 VS 2015 一起使用的部分专用模板代码 直到我发现它不符合标准 https stackoverflow com q 3052579 2747466 我希望如此 所以我扭曲了我的代码来克服前一个问题 并且that one ht
c
recursion
c14
variadictemplates
compiletime
在 C++11 中使用 max
作为谓词会中断
在 C 03 中 以下代码工作正常 int main std vector
c
C11
c14
如何迭代 std::index_sequence
我的源代码中有这段代码 template
c
C11
c14
variadicfunctions
indexsequence
当现在允许使用虚拟基地移动分配运算符时,会有危险吗?
这涉及到C 问题的解决http www open std org jtc1 sc22 wg21 docs cwg defects html 1402 http www open std org jtc1 sc22 wg21 docs cwg
c
C11
c14
deletedfunctions
为什么要为具有重要析构函数的类声明 constrexpr 构造函数(例如 unique_ptr、std::variant)
据我了解 至少对于c 14 析构函数不能是constexpr如果它不是微不足道的 隐式生成或 default 声明的意义何在constexpr具有非平凡析构函数的结构的构造函数 struct X int a constexpr X int
c
c14
constexpr
C17
类型特征的 _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
[现代] C++ 中 N 个变量的范围/循环
遍历 N 个任意类型的变量来执行操作的简洁方法是什么 假设我有变量a b c d e并想要对他们所有人进行一些操作 使用 Boost Hana 和通用 lambda include
c
C11
boost
c14
C17
1
2
3
4
5
6
...19
»