To błąd zarówno w VS2012, jak i VS2013, ponieważ nie jest zgodny ze standardem C++ 11 (z _HAS_CPP0X
zdefiniowanym jako 1)
C++ 03 23.1.1 [lib.sequence.reqmts]/9 mówi:
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.
lecz z C++ 11 23.2.3 [sequence.reqmts]/14
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.
że konstruktor nie powinny były zostać uznane za wszelką
więcej tutaj: https://stackoverflow.com/a/12432482/1938163
Aby obejść ten problem, można "pomóc w rozwiązaniu nadmiernego przeciążenia nieco", np.
std::vector<int> v(static_cast<std::vector<int>::size_type>(N), M);
Zarówno gcc, jak i clang są w porządku z tym, wydaje się jak błąd. –
Zdecydowanie podejrzewam, że błąd VS .. –