c++ - Coping with C++11 initialization syntaxes -
As a new uniform presents the initial syntax, many older styles use syntax instead of using it Recommend. At least, if it was not for the case of this so-called corner: Using a {} -ways-style screams for trouble, especially for the new syntax in the template only takes three safe uses: < / P> But there is also a case in which we have to use the same initial syntax: Non-static data member initiator can identify C ++ for some reason but Question # 1: Why inside the function () -Syntex works, but no classes? Does anyone know the logic behind this? By putting it together, at the end we reach this silly case: Of course, you can not even use auto for data members. So I have to combine all the syntaxs oddly or do not use these facilities at all. Question # 2: Was not I wrong? Its behavior can not be treated, is it Question # 1: Why does () -Syntex works inside the function, but no class? Does anyone know the logic behind this? Because it can look like a function declaration, and it already has enough confusion: but you can use This is a design behavior, it is unfortunate that this standard type of standard library containers (such as Look at this related question: You can try to design your own orbits that they are not suffering from this problem.
zero times () {foo f (200); }
straight bar {FUF (200); };
Foo f (); // function declaration still excludes people
() , just Copy-initialization syntax:
tt = t (args); Question # 2: Did I do something wrong? This behavior can not be intended, maybe?
std :: vector & lt; int & gt; in your example) Does not play very well with. All you have to do is remember that a vested
initializer_list constructor harasses all other relevant constructors.
Comments
Post a Comment