Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Initializing member array of structs
//Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64 #include <iostream> struct MyStruct { int x; int y; }; class MyClass { public: MyClass() : s { } { } /*MyClass() : s { {1, 2}, { 3, 4} } { }*/ void print() { std::cout << s[0].x << std::endl; std::cout << s[0].y << std::endl; std::cout << s[1].x << std::endl; std::cout << s[1].y << std::endl; } private: MyStruct s[2]; }; int main() { MyClass c; c.print(); }
run
|
edit
|
history
|
help
-1
What exactly is “broken” with Microsoft Visual C++'s two-phase template instantiation?
_countof constexpr
base call virtual
No UD
Cannot allocate an array of constant size 0
delete from list
3
throwing std::function on MSVC is dangerous
make Derive final
ccloader