C++ STL में unordered_multimap size() फ़ंक्शन अनऑर्डर्ड मैप में एलिमेंट्स की संख्या लौटाता है।
एल्गोरिथम
Begin Declare an empty map container m. Performing reserve function to restrict the most appropriate bucket_count of the map container. Insert values in the map container. Print the size of the unorderd multimap container by using the size() function. End
उदाहरण कोड
#include<iostream> #include <bits/stdc++.h> using namespace std; int main() { unordered_map<char, int> m; // m को खाली मैप कंटेनर के रूप में घोषित करना m.reserve(6); //मैप कंटेनर के सबसे उपयुक्त bucket_count को प्रतिबंधित करना m.insert (pair<char, int>('b', 10)); // कुछ मान डालना m.insert (pair<char, int>('a', 20)); cout << "The size is: " << m.size(); //size() फ़ंक्शन द्वारा अनऑर्डर्ड मल्टीमैप कंटेनर का आकार प्रिंट करना। return 0; }
आउटपुट
The size is :2