Skip to content

Latest commit

 

History

History
100 lines (85 loc) · 2.11 KB

deque-clear-stl-clr.md

File metadata and controls

100 lines (85 loc) · 2.11 KB
title deque::clear (STL/CLR) | Microsoft Docs
ms.custom
ms.date 11/04/2016
ms.reviewer
ms.suite
ms.technology
cpp-windows
ms.tgt_pltfrm
ms.topic reference
f1_keywords
cliext::deque::clear
dev_langs
C++
helpviewer_keywords
clear member [STL/CLR]
ms.assetid 1d9a3d11-b3fa-43a7-a508-7a05cbcd91bf
caps.latest.revision 15
author mikeblome
ms.author mblome
manager ghogen
translation.priority.ht
cs-cz
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
pl-pl
pt-br
ru-ru
tr-tr
zh-cn
zh-tw

deque::clear (STL/CLR)

Removes all elements.

Syntax

void clear();  

Remarks

The member function effectively calls deque::erase (STL/CLR)( deque::begin (STL/CLR)(), deque::end (STL/CLR)()). You use it to ensure that the controlled sequence is empty.

Example

// cliext_deque_clear.cpp   
// compile with: /clr   
#include <cliext/deque>   
  
int main()   
    {   
    cliext::deque<wchar_t> c1;   
    c1.push_back(L'a');   
    c1.push_back(L'b');   
    c1.push_back(L'c');   
  
// display initial contents " a b c"   
    for each (wchar_t elem in c1)   
        System::Console::Write(" {0}", elem);   
    System::Console::WriteLine();   
  
// clear the container and reinspect   
    c1.clear();   
    System::Console::WriteLine("size() = {0}", c1.size());   
  
// add elements and clear again   
    c1.push_back(L'a');   
    c1.push_back(L'b');   
  
    for each (wchar_t elem in c1)   
        System::Console::Write(" {0}", elem);   
    System::Console::WriteLine();   
    c1.clear();   
    System::Console::WriteLine("size() = {0}", c1.size());   
    return (0);   
    }  
  
 a b c  
size() = 0  
 a b  
size() = 0  

Requirements

Header: <cliext/deque>

Namespace: cliext

See Also

deque (STL/CLR)
deque::erase (STL/CLR)