共用方式為


unordered_set::end

指定受控制序列的結尾。

iterator end();
const_iterator end() const;
local_iterator end(size_type nbucket);
const_local_iterator end(size_type nbucket) const;

參數

參數

描述

nbucket

值區數目。

備註

第一個的兩個成員函式會傳回正 iterator 那些只是超出序列結尾的點。 最後兩個成員函式會傳回正 iterator 桶結尾之外,只要那些點nbucket。

範例

// std_tr1__unordered_set__unordered_set_end.cpp 
// compile with: /EHsc 
#include <unordered_set> 
#include <iostream> 
 
typedef std::unordered_set<char> Myset; 
int main() 
    { 
    Myset c1; 
 
    c1.insert('a'); 
    c1.insert('b'); 
    c1.insert('c'); 
 
// display contents " [c] [b] [a]" 
    for (Myset::const_iterator it = c1.begin(); 
        it != c1.end(); ++it) 
        std::cout << " [" << *it << "]"; 
    std::cout << std::endl; 
 
// inspect last two items " [a] [b]" 
    Myset::iterator it2 = c1.end(); 
    --it2; 
    std::cout << " [" << *it2 << "]"; 
    --it2; 
    std::cout << " [" << *it2 << "]"; 
    std::cout << std::endl; 
 
// inspect bucket containing 'a' 
    Myset::const_local_iterator lit = c1.end(c1.bucket('a')); 
    --lit; 
    std::cout << " [" << *lit << "]"; 
 
    return (0); 
    } 
 
  

需求

標頭: <unordered_set>

Namespace: 標準

請參閱

參考

<unordered_set>

unordered_set Class

unordered_set::begin

其他資源

<unordered_set> 成員