What’s the difference between Radio r = Radio(“PSR”, 100.8) and Radio(“PSR”, 100.8)?

Radio r = Radio(“PSR”, 100.8); is copy initialization while Radio r(“PSR”, 100.8); is direct initialization. C++17 From C++17 due to mandatory copy elison both are the equivalent. Radio r = Radio(“PSR”, 100.8); //from C++17 this is same as writing Radio r(“PSR”, 100.8); Prior C++17 But prior to C++17, the first case Radio r = Radio(“PSR”, … Read more

What are the differences between C-like, constructor, and uniform initialization?

First, I would recommend looking at the following talk by Herb Sutter, in which he gives some recommendations about the subject. The brace-initialization discussion starts at around 23:00. When you are talking about primitive data types, all 3 yield the same result. I personally prefer sticking with the old int x = 0 syntax, but … Read more