A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/cpp/unordered_multiset-max_bucket_count-function-in-c-stl/ below:

unordered_multiset max_bucket_count() function in C++ STL

unordered_multiset max_bucket_count() function in C++ STL

Last Updated : 02 Aug, 2018

The

unordered_multiset::max_bucket_count()

is a built-in function in C++ STL which returns the maximum number of buckets that the unordered multiset container can have. This is the maximum it can have, it cannot exceed despite the collisions due to certain limitations on it.

Syntax

:

unordered_multiset_name.max_bucket_count()
Parameter

: The function does not accepts anything.

Return Value

: The function returns the maximum number of buckets possible. Below programs illustrate the

unordered_multiset::maximum_bucket_count()

function:

Program 1

:

CPP
// C++ program to illustrate the
// unordered_multiset::maximum_bucket_count() function
#include <bits/stdc++.h>
using namespace std;

int main()
{

    // declaration
    unordered_multiset<char> sample;

    // inserts element
    sample.insert('a');
    sample.insert('b');
    sample.insert('b');
    sample.insert('b');
    sample.insert('z');

    cout << "The maximum bucket count is: " << 
                      sample.max_bucket_count();

    return 0;
}
Output:
The maximum bucket count is: 1152921504606846975
Program 2

:

CPP
// C++ program to illustrate the
// unordered_multiset::maximum_bucket_count() function
#include <bits/stdc++.h>
using namespace std;

int main()
{

    // declaration
    unordered_multiset<int> sample;

    // inserts element
    sample.insert(1);
    sample.insert(2);
    sample.insert(2);
    sample.insert(4);
    sample.insert(4);

    cout << "The maximum bucket count is: " 
                << sample.max_bucket_count();

    return 0;
}
Output:
The maximum bucket count is: 1152921504606846975


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4