共用方式為


list::remove (STL/CLR)

移除項目與指定的值。

    void remove(value_type val);

參數

  • val
    要移除之項目的值。

備註

成員函式移除 ((System::Object^)val)->Equals((System::Object^)x) 真正的受控制序列的項目 (如果有的話)。 您會用它來清除具有指定值的選擇性項目。

範例

// 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); 
    } 
 
  

需求

標題: <cliext/清單>

命名空間: cliext

請參閱

參考

list (STL/CLR)

list::clear (STL/CLR)

list::erase (STL/CLR)

list::remove_if (STL/CLR)