c++ - 为什么调用 A a(A()) 什么都不输出?
问题描述
我想知道这段代码发生了什么?而且,调用 A a(other) 有什么不同。
#include <iostream>
#include <string>
#define LOG() (cout << __PRETTY_FUNCTION__ << endl)
using namespace std;
struct A
{
A() { LOG(); }
A(const A&) { LOG(); }
const A& operator=(const A&) { LOG(); }
};
int main(void)
{
A a(A());
return 0;
}
什么都不输出。
解决方案
推荐阅读
- python - 70 GB ALTO Xml 文件解析
- c# - 如何限制 .net core 中不同项目之间的可访问性?
- python - Python:请求在 url 中添加变量
- python - 使用请求下载 .pdf 会导致文件损坏
- java - 如何验证在对象上调用了仅通过反射知道的 java.lang.reflect.Method
- .net - 进程无权写入 Windows 注册表
- ruby-on-rails - 如何创建一个正则表达式来避免 ruby 中的 url
- google-bigquery - BigQuery:如何将字段添加到 REPEATED 记录?
- java - 创建 kubernetes 部署时 Quarkus RestClient 属性的 env 值无效
- excel - 如何在 Excel VBA 中自动增加单元格引用,以便在每一列中运行宏?