Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
std::remove() 按预期使用文字,但不适用于取消引用的迭代器
在学习删除 擦除惯用语的同时 以及了解 std min element 的工作原理如何在 C 17 中使用 std min element 我想尝试从以下代码中删除最小元素 include
c
C17
成员变量的结构化绑定
在Visual Studio 2017中 打开后 std c 17 我可以 auto d1 d2 func return tuple where func return tuple 返回两个双精度值的元组 但是 如果A类有两个成员变量d1
c
tuples
C17
如何检测构造函数确实是 constexpr,以便我可以利用静态初始化?
看这段代码 struct NonConstexpr NonConstexpr template
c
C17
将引用作为参数的模板参数推导
我正在尝试深刻理解模板论证推导 我不明白的一点是 我应该如何应用标准中的规则here对于类型A and P对于以下情况 遗憾的是 cppreference com 上没有示例 请参阅下面的相关部分 template
c
templates
C17
templateargumentdeduction
通过 std::Optional 标准化,我们可以停止在新代码中使用 nullptr 并弃用它吗? [关闭]
Closed 这个问题是基于意见的 目前不接受答案 从远古时代开始 当向函数传递指针或从函数传递指针时 我们倾向于对空指针进行特殊处理 p get pointer to the foo args if p nullptr foo is in
c
pointers
C17
idioms
nullptr
访问 std::variant 中的公共结构成员
我无法理解如何使用std variant在 C 17 中 给定两个结构体A and B and a std vector
c
struct
C17
Variant
默认 lambda 作为函数的模板化参数
考虑下面的代码 template
c
templates
Lambda
C17
defaultparameters
带括号的“嵌套”类模板参数推导:GCC 与 clang
相关 但 恕我直言 不同 类模板的嵌套模板参数推导不起作用 以下 C 17 代码被 GCC 8 拒绝 但 clang 编译它没有任何问题 GCC 的错误消息作为注释包含在有问题的行之前 这里哪个编译器是正确的 https godbolt o
c
templates
compilererrors
languagelawyer
C17
将用户输入转换为 C++ 中的类型时有太多 if/else 语句
我有一个带有 3 个模板参数的模板类 template
c
commandlineinterface
C17
类型擦除类型擦除,“有什么”问题吗?
所以 假设我想使用类型擦除来键入擦除 我可以为变体创建伪方法 以实现自然的 pseudo method print auto self auto os os lt lt self std variant
c
typeerasure
C17
stdany
为什么没有 std::move_if 算法?
我在互联网上看到过一些地方 他们描述了使用std copy if with std make move iterator 但如果迭代器是前向迭代器 则会导致有效但未指定的 VBU 对象分散在源容器周围 拥有一个不是更好吗std move i
c
C17
P0522R0如何破码?
今天我正在阅读 clang 的 C 17 支持页面 我注意到一些奇怪的事情 特点将模板模板参数与兼容的参数相匹配 P0522R0 被标记为部分 因为它必须通过开关激活 他们的笔记says 尽管是缺陷报告的解决方案 但该功能在所有语言版本中默
c
languagelawyer
Clang
C17
C++17 中对数组的赋值
这是一些代码 int main using T int 3 T a a T 据我所知 根据 C 17 标准 这段代码是正确的 但是我尝试的每个编译器都拒绝了它 这段代码实际上是错误的吗 如果是这样 根据标准的哪些条款 到目前为止我的调查 在
c
Arrays
languagelawyer
C17
variableassignment
将 std::experimental::filesystem 与 Xcode 9 链接
我正在使用 std experimental filesystem 和 Xcode 9 0 beta 编译器阶段完成正常 但链接器抱怨未定义的符号 std experimental filesystem v1 path filename c
xcode
MacOS
C17
准备弃用 std::iterator
On March 21st the standards committee voted to approve the deprecation of std iterator proposed in P0174 对于读者来说 一长串的 voi
c
Iterator
standards
deprecated
C17
获取函数参数类型作为元组
Problem 给定任何函数 或可调用 类型Function 如何将其所有参数类型作为元组类型获取 例如 我需要一个特质function traits
c
templates
C17
variadictemplates
templateargumentdeduction
调用基本构造函数时是否应该复制继承构造函数的参数?
对于以下程序 include
c
VisualStudio
C17
inheritedconstructors
[[maybe_unused]] 在成员变量上,GCC 警告(错误地?)该属性被忽略
在下面的example struct Foo maybe unused int member 1 void bar maybe unused int local 0 int main int argc char argv Foo f f b
c
C17
compilerwarnings
compilerbug
布局兼容类型的目的是什么?
标准defines当两种类型是布局兼容 但是 我在标准中没有看到当两种类型同时存在时会产生什么后果布局兼容 看起来布局兼容是一个没有在任何地方使用的定义 目的是什么布局兼容 注意 据说 这可能意味着类型具有相同的布局 offsetof对于每
c
struct
languagelawyer
C17
memorylayout
现代 C++ 方法重复代码设定次数
很简单 是否有一种更简单的方法来重复一个块一定次数 其中块内部不需要计数器变量 简单的解决方案当然是 for int i 0 i lt repetitions i do your thing i is not used here 然而 既然
c
loops
C17
C20
«
1 ...
16
17
18
19
20
21
22
»