直接初始化参数中的 auto ( expression )
作者:Fedor 提问时间:11/12/2023
在 C++23 中,我们有显式类型转换,并且根据 cppreference 它已经被 GCC 和 Clang 支持。auto ( expression ) 我有一个问题,由于某种原因没有发生这种投射...
律师 问答列表
作者:Fedor 提问时间:11/12/2023
在 C++23 中,我们有显式类型转换,并且根据 cppreference 它已经被 GCC 和 Clang 支持。auto ( expression ) 我有一个问题,由于某种原因没有发生这种投射...
作者:Destructor 提问时间:10/22/2015
请考虑以下程序(在此处查看现场演示)。 #include <stdio.h> int main(void) { int ; // Missing variable name puts("Surp...
作者:sharptooth 提问时间:11/16/2010
C++ 中的单定义规则到底说了什么? 我能找到的唯一可靠的例子是《C++编程语言》,第3版,第9.2.3页。除此之外,该规则是否有任何官方定义?...
作者:Niall 提问时间:7/18/2014
在上一个问题之后,我一直在挖掘 ref-qualifiers。 给定下面的代码示例; #include <iostream> #include <string> #include <utility...
作者:xmllmx 提问时间:7/2/2021
#include <compare> struct A { int n; auto operator<=>(A const& other) const { if (n < other.n)...
作者:H Bellamy 提问时间:2/27/2017
运行此代码时,Clang (3.9.1) 和 GCC (7, snapshot) 将“1”、“2”打印到控制台。 但是,MSVC 无法编译此代码: source_file.cpp(15):错误 C...
作者:Enlico 提问时间:5/9/2020
我正在阅读Ivan Čukić的《C++函数式编程》,我很难解释第5章摘要中的一个观点: 当您创建成员函数时,您承诺该函数不会更改类中的任何数据(对象不会更改任何数据),或者就对象的用户而言,对对象...
作者:Emil 提问时间:8/11/2021
如问题 lambda capture by value mutable does not work with const &?,当使用其名称或在可变 lambda 中捕获类型的值时,隐藏类中的字段会获...
作者:Ángel 提问时间:10/8/2023
我有这个简单的小代码: #include <iostream> int Add (int x, int y) { std::cout << "In Add(), received " <<x<<...
作者:Zebrafish 提问时间:6/5/2022
我遇到了一个有趣的问题,我不明白发生了什么: /* I WANT 6 ELEMENTS */ int lvalue = 6; std::vector<int*> myvector { 6 }; /...