Partager via


liste : : supprimez (STL/CLR)

Removes an element with a specified value.

    void remove(value_type val);

Paramètres

  • val
    Value of the element to remove.

Notes

The member function removes an element in the controlled sequence for which ((System::Object^)val)->Equals((System::Object^)x) is true (if any). You use it to erase an arbitrary element with the specified value.

Exemple

// cliext_list_remove.cpp 
// compile with: /clr 
#include <cliext/list> 
 
int main() 
    { 
    cliext::list<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(); 
 
// fail to remove and redisplay 
    c1.remove(L'A'); 
    for each (wchar_t elem in c1) 
        System::Console::Write(" {0}", elem); 
    System::Console::WriteLine(); 
 
 
// remove and redisplay 
    c1.remove(L'b'); 
    for each (wchar_t elem in c1) 
        System::Console::Write(" {0}", elem); 
    System::Console::WriteLine(); 
    return (0); 
    } 
 
  

Configuration requise

Header: <cliext/list>

Namespace: cliext

Voir aussi

Référence

list (STL/CLR)

liste : : espace libre (STL/CLR)

liste : : effacement (STL/CLR)

liste : : remove_if (STL/CLR)