while reading answer to one question on MS Connect site I noticed the following part of the reply:
This is one of a few breaking changes in the Standard Library that I’m
aware of (the other major ones are immutable sets, and 2D vector
construction).
Answer can be considered legit with high probability since it is from MS employee that works on implementing STL.
So does anybody knows what exactly he refers to?
I emailed Stephan and asked what he was talking about. Here’s his answer (edited for formatting). It didn’t sound like he was planning to post the answer here; if he does, I’ll delete this copy.
Everything from here down is Stephan speaking.
I was referring to this:
It compiles with VC10 SP1 (following C++03), but not with VC11 RTM (following C++11): [snip error message dump]
C++03 23.1.1 [lib.sequence.reqmts]/9 said:
This transformed
vector<vector<int>> v(11, 22)tovector<vector<int>> v(static_cast<size_t>(11), static_cast<vector<int>>(22)), which is valid. (static_castis capable of invoking explicit constructors, likevector‘s size constructor.)C++11 23.2.3 [sequence.reqmts]/14 says:
This removes the (InIt, InIt) ctor from overload resolution. That leaves
(size_type n, const T& value), whereTisvector<int>. However, that would try to implicitly convert22to a temporaryvector<int>(in order to bind it toconst T&). The explicitness ofvector‘s size constructor forbids that.Reading the other SO question, this is a different issue.
STL