Why would they special-case certain initializer lists instead of treating them all the same?
- 阅读更多 关于 Why would they special-case certain initializer lists instead of treating them all the same?
Say I have a variable auto x that I want to initialize to 7 using brace initialization, simple: auto x {7}; Except I learned that x is NOT an integer, but an initialization list itself. Why? Is there a specific reason why the committee would decide that auto should grab the initialization list in the case of a single auto value, or do they expect us to just realize these shouldn't be used together. I cant seem to think of a possible reason i would want an initializer list to be stored into auto as opposed to the value A very practical answer is, "why should int be selected?" Or double , or any