다음을 통해 공유


hash_multiset::load_factor (STL/CLR)

버킷 당 평균 요소 수를 계산 합니다.

    float load_factor();

설명

The member function returns (float)hash_multiset::size (STL/CLR)() / hash_multiset::bucket_count (STL/CLR)().이 평균 버킷 크기를 결정할 수 있습니다.

예제

// cliext_hash_multiset_load_factor.cpp 
// compile with: /clr 
#include <cliext/hash_set> 
 
typedef cliext::hash_multiset<wchar_t> Myhash_multiset; 
int main() 
    { 
    Myhash_multiset c1; 
    c1.insert(L'a'); 
    c1.insert(L'b'); 
    c1.insert(L'c'); 
 
// display initial contents " a b c" 
    for each (wchar_t elem in c1) 
        System::Console::Write(" {0}", elem); 
    System::Console::WriteLine(); 
 
// inspect current parameters 
    System::Console::WriteLine("bucket_count() = {0}", c1.bucket_count()); 
    System::Console::WriteLine("load_factor() = {0}", c1.load_factor()); 
    System::Console::WriteLine("max_load_factor() = {0}", 
        c1.max_load_factor()); 
    System::Console::WriteLine(); 
 
// change max_load_factor and redisplay 
    c1.max_load_factor(0.25f); 
    System::Console::WriteLine("bucket_count() = {0}", c1.bucket_count()); 
    System::Console::WriteLine("load_factor() = {0}", c1.load_factor()); 
    System::Console::WriteLine("max_load_factor() = {0}", 
        c1.max_load_factor()); 
    System::Console::WriteLine(); 
 
// rehash and redisplay 
    c1.rehash(100); 
    System::Console::WriteLine("bucket_count() = {0}", c1.bucket_count()); 
    System::Console::WriteLine("load_factor() = {0}", c1.load_factor()); 
    System::Console::WriteLine("max_load_factor() = {0}", 
        c1.max_load_factor()); 
    return (0); 
    } 
 
  

요구 사항

헤더: < cliext/hash_set >

네임 스페이스: cliext

참고 항목

참조

hash_multiset (STL/CLR)

hash_multiset::bucket_count (STL/CLR)

hash_multiset::max_load_factor (STL/CLR)