Home » C++ multiset get_allocator() function

C++ multiset get_allocator() function

by Online Tutorials Library

C++ Multiset get_allocator()

C++ Multiset get_allocator() function is used to return the copy of allocator object which helps to construct the multiset container.

Syntax

Parameter

None

Return value

get_alloactor() function returns an allocator associated with multiset container.

Complexity

Constant.

Iterator validity

No changes.

Data Races

The container is accessed.

Concurrently accessing the elements of multiset is safe.

Exception Safety

This function never throws exceptions.

Example 1

Let’s see the simple example:

Output:

Allocated size = 32  

Example 2

Let’s see a simple example:

Output:

The allocated array contains: 10 20 30 40 50  

Example 3

Let’s see a simple example to check whether the allocators are interchangeable or not:

Output:

The number of integers that can be allocated  before free memory is exhausted: 461168601842738790.    The number of doubles that can be allocated  before free memory is exhausted: 461168601842738790.    The allocators are interchangeable.  

Example 4

Let’s see a simple example:

Output:

42, 43  
Next TopicC++ multiset

You may also like