How to use the list::assign, list::empty, and list::erase STL functions in Visual C++
This article was previously published under Q158085 NOTE: Microsoft Visual C++ .NET (2002) and Visual C++ .NET (2003)
support both the managed code model that is provided by the .NET Framework and
the unmanaged native Windows code model. The information in this article
applies to unmanaged Visual C++ code only. On This PageSUMMARY The sample code below illustrates how to use the
list::assign, list::empty, and list::erase STL functions in Visual C++.
MORE INFORMATIONRequired HeaderPrototypeNOTE: The class/parameter names in the prototype may not match the
version in the header file. Some have been modified to improve readability. DescriptionThe first member function replaces the sequence controlled by *this with the sequence [first, last). The second member function replaces the sequence controlled by *this with a repetition of n elements of value x.The third member function removes the element of the controlled sequence pointed to by it. The fourth member function removes the elements of the controlled sequence in the range [first, last). Both return an iterator that designates the first element remaining beyond any elements removed, or end() if no such element exists. The last member function returns true for an empty controlled sequence. Sample Code Program Output is: 1 2 3 1 1 1 1 1 1 1 All gone REFERENCES For the same information about list::assign, list::empty,
and list::erase, visit the following MSDN Web site: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcstdlib/html/vcsampsamplelistccassignstlsample.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcstdlib/html/vcsampsamplelistccassignstlsample.asp) APPLIES TO
| Article Translations
| ||||||||||||||||||||||||||||||||||||||||||||

Back to the top
