PRB: C2664 Instantiating STL List with Sequence [first, last) (168404)
The information in this article applies to:
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
This article was previously published under Q168404 SYMPTOMS
Instantiating an STL list container with a sequence [first, last), where
first and last are iterators, causes the compiler error C2664:
'function': cannot convert parameter number from 'type1' to 'type2'
CAUSE
Using the list(const_iterator first, const_iterator last, const A& a1= A())
constructor causes the compiler error C2664. The constructor for list takes
a list<T>::const_iterator instead of a generic iterator for the first two
parameters.
RESOLUTIONWorkaround 1
Use the default constructor. Insert elements in the list using the
push_back member function.
Workaround 2
Use the list(size_type, const T& v = T(), const A& a1 = A()) constructor.
Insert elements in the list using the copy algorithm.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. This problem was corrected in Microsoft
Visual C++, version 6.0.
Modification Type: | Major | Last Reviewed: | 10/17/2003 |
---|
Keywords: | kbBug kbCompiler kbCPPonly kbfix kbprb kbVC600fix KB168404 |
---|
|