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:
#include <vector>
using namespace std;
int main() {
vector<vector<int>> v(11, 22);
}
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:
For every sequence defined in this clause and in clause 21:
— the constructor
template <class InputIterator> X(InputIterator f, InputIterator l, const Allocator& a = Allocator())
shall have the same effect
as:
X(static_cast<typename X::size_type>(f), static_cast<typename X::value_type>(l), a)
if InputIterator
is an integral type.
This transformed vector<vector<int>> v(11, 22)
to vector<vector<int>> v(static_cast<size_t>(11), static_cast<vector<int>>(22))
, which is valid. (static_cast
is capable of invoking explicit constructors, like vector
's size constructor.)
C++11 23.2.3 [sequence.reqmts]/14 says:
For every sequence container defined in this Clause and in Clause 21:
— If the constructor
template <class InputIterator> X(InputIterator first, InputIterator last, const allocator_type& alloc = allocator_type())
is called with a type InputIterator
that does not qualify as an input iterator, then the constructor shall not participate in overload resolution.
This removes the (InIt, InIt) ctor from overload resolution. That leaves (size_type n, const T& value)
, where T
is vector<int>
. However, that would try to implicitly convert 22
to a temporary vector<int>
(in order to bind it to const T&
). The explicitness of vector
's size constructor forbids that.
Reading the other SO question, this is a different issue.
STL