Article ID: 156590 - Last Review: August 11, 2005 - Revision: 5.2 How to use the deque::erase, deque::clear, deque::begin, and deque::end Standard Template Library (STL) functions in Visual C++This article was previously published under Q156590 On This PageSUMMARY The sample code below illustrates how to use the
deque::erase, deque::clear, deque::begin, and deque::end STL functions in
Visual C++. MORE INFORMATIONRequired HeaderPrototypeDescriptionThe first erase member function removes the element of the container pointed to by iter. The second erase member function removes the elements of the container 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.Removing N elements causes N destructor calls and an assignment for each of the elements between the insertion point and the nearer end of the sequence. Removing an element at either end invalidates only iterators and references that designate the erased elements. Otherwise, erasing an element invalidates all iterators and references. The clear member function calls erase( begin(), end()). Sample CodeNOTE: In the first line of the sample code section, /GX is equivalent to /EHsc in VC++ .NET and is set by default.The output is: 1 2 3 4 5 The output is: 1 3 4 5 The output is: 1 3 The output is: REFERENCESFor the same information about deque::erase and
deque::clear, visit the following MSDN Web site: http://msdn.microsoft.com/en-us/library/8hy3w6ky.aspx (http://msdn.microsoft.com/en-us/library/8hy3w6ky.aspx) For the same information about deque::begin and deque::end, visit the following MSDN Web site: http://msdn.microsoft.com/en-us/library/1ew0xf3z.aspx (http://msdn.microsoft.com/en-us/library/1ew0xf3z.aspx) APPLIES TO
| Article Translations
|
Back to the top
