downdemo / effective-modern-cpp Goto Github PK
View Code? Open in Web Editor NEWC++11/14/17 best practices for getting started quickly with modern C++.
Home Page: https://downdemo.github.io/Effective-Modern-Cpp/
License: Apache License 2.0
C++11/14/17 best practices for getting started quickly with modern C++.
Home Page: https://downdemo.github.io/Effective-Modern-Cpp/
License: Apache License 2.0
#include <iostream>
struct A {
A() { std::cout << 1; }
A(std::initializer_list<int>) { std::cout << 2; }
};
int main() {
A a{}; // 1
A b; // 2
A c({}); // 2
}
我在clang 16.0.6 测试了一下,输出是112,A b;
会匹配到 A()
输出 1。你这里给的 2 和我在vscode 鼠标放在 A b
显示的智能提示也是 2。
class Widget {
public:
Widget(); //默认构造函数
Widget(std::initializer_list<int> il); //std::initializer_list构造函数
… //没有隐式转换函数
};
Widget w1; //调用默认构造函数
Widget w2{}; //也调用默认构造函数
Widget w3(); //最令人头疼的解析!声明一个函数
Widget w4({}); //使用空花括号列表调用std::initializer_list构造函数
Widget w5{{}}; //同上
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.