The information in this article applies to:
SYMPTOMSInstantiating an STL list container with a sequence [first, last), where first and last are iterators, causes the compiler error C2664:
CAUSEUsing 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 1Use the default constructor. Insert elements in the list using the push_back member function.Workaround 2Use the list(size_type, const T& v = T(), const A& a1 = A()) constructor. Insert elements in the list using the copy algorithm.STATUSMicrosoft 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. MORE INFORMATIONThe following sample demonstrates the problem:
The exact error message for the above sample is:
The following sample demonstrates Workaround 1:
The following sample demonstrates Workaround 2:
Additional query words: list copy push_back
Keywords : kbCompiler kbCPPonly kbVC kbVC500bug kbVC600fix STLIss |
Last Reviewed: August 18, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |