Initialization
#include <vector> | |
class B{}; | |
class A{ | |
B b; | |
public: | |
A(B b):b(b){} | |
}; | |
int main(){ | |
A a{B()}; // There is no ambiguity here. | |
int var1{}; // Zero-initialized to 0; | |
char* var2{};// Zero-initialized to nullptr; | |
std::vector v1{}; // Each member is zero-initialized | |
std::vector v2{1,2,3}; // Vector is initialized with | |
// 3 elements 1,2 and 3. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment