C++ set get_allocator()C++ set get_allocator() function is used to return the copy of allocator object which helps to construct the set container. SyntaxParameterNone Return valueReturns an allocator associated with set container. ComplexityConstant. Iterator validityNo changes. Data RacesThe container is accessed. Concurrently accessing the elements of set is safe. Exception SafetyThis function never throws exceptions. Example 1Let's see the simple example: Output: Allocated size = 32 Example 2Let's see a simple example: Output: The allocated array contains: 10 20 30 40 50 Example 3Let'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 4Let's see a simple example: Output: 42, 43
Next TopicSet operator==
|