GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::unordered_map::size(3) C++ Standard Libary std::unordered_map::size(3)

std::unordered_map::size - std::unordered_map::size


size_type size() const noexcept; (since C++11)


Returns the number of elements in the container, i.e. std::distance(begin(), end()).


(none)


The number of elements in the container.


Constant.


The following code uses size to display the number of elements in a
std::unordered_map:

// Run this code


#include <unordered_map>
#include <iostream>


int main()
{
std::unordered_map<int,char> nums {{1, 'a'}, {3, 'b'}, {5, 'c'}, {7, 'd'}};


std::cout << "nums contains " << nums.size() << " elements.\n";
}


nums contains 4 elements.


empty checks whether the container is empty
(C++11) (public member function)
max_size returns the maximum possible number of elements
(C++11) (public member function)
size
ssize returns the size of a container or array
(C++17) (function template)
(C++20)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.