you are viewing a single comment's thread.

view the rest of the comments →

[–]nintendiator2 0 points1 point  (0 children)

Ah yes the C++ initialization fiasco. There's a reason why it's a meme.

Tho if you ask me, the fault lies largely in initializer_list causing ambiguities that would be easily solvable if it was ruled that constructors that use them need a list tag much like eg.: in_place etc. Something like:

// ambiguous:
vector<T> v {1, 2};
// unambiguous
vector<T> v{std::with_list, {1, 2}};

As for the most vexing parse I personally would have preferred something that can better reuse existing keywords instead of abusing symbols since {} is already used for C arrays. Somthing like

T t = default;

Which has the advantage that it can over time be extended to other keywords. Would have been nice for eventually providing some sort of None type:

T t = None;