Q&A - C++ Initialization -- Bartlomiej Filipek
Last time I showed a couple of questions about initialization. Try them here if you haven’t already. In this article, I’ll show you the answers and add more notes about initialization in C++.
Q&A - C++ Initialization
by Bartlomiej Filipek
From the article:
Will this code work in C++11?
struct User { std::string name = "unknown"; unsigned age { 0 }; };
User u { "John", 101 };
- Yes, the code compiles in C++11 mode.
- The code compiles starting with C++14 mode.
- The code doesn’t compile even in C++20.

Registration is now open for CppCon 2023! The conference starts on October 1 and will be held
In a previous
Registration is now open for CppCon 2023! The conference starts on October 1 and will be held
Every year we run Pure Virtual C++: a free one-day virtual conference for the whole C++ community. Next month we’re doing it again!
This conference is organized by the C++ Community for the C++ Community. We want the whole community to be represented. We especially encourage those who identify as coming from an underrepresented community to apply to present and to be present. Presenting a talk is not limited to previous presenters or previous attendees.
The submission deadline is June 25th, with decisions sent by July 31st.