<hash_map> functions

swap
swap (hash_map)

swap (hash_map)

Note

This API is obsolete. The alternative is unordered_map Class.

Exchanges the elements of two hash_maps.

void swap(
    hash_map <Key, Type, Traits, Alloctor>& left,
    hash_map <Key, Type, Traits, Allocator>& right);

Parameters

right
The hash_map whose elements are to be exchanged with those of the map left.

left
The hash_map whose elements are to be exchanged with those of the map right.

Remarks

The template function is an algorithm specialized on the container class hash_map to execute the member function left.swap(right). This is an instance of the partial ordering of function templates by the compiler. When template functions are overloaded in such a way that the match of the template with the function call is not unique, then the compiler will select the most specialized version of the template function. The general version of the template function, template <class T> void swap(T&, T&), in the algorithm header file works by assignment and is a slow operation. The specialized version in each container is much faster as it can work with the internal representation of the container class.

swap

Note

This API is obsolete. The alternative is unordered_multimap Class.

Exchanges the elements of two hash_multimaps.

void swap(
    hash_multimap <Key, Type, Traits, Alloctor>& left,
    hash_multimap <Key, Type, Traits, Allocator>& right);

Parameters

right
The hash_multimap whose elements are to be exchanged with those of the map left.

left
The hash_multimap whose elements are to be exchanged with those of the map right.

Remarks

The template function is an algorithm specialized on the container class hash_multimap to execute the member function left.swap(right). This is an instance of the partial ordering of function templates by the compiler. When template functions are overloaded in such a way that the match of the template with the function call is not unique, then the compiler will select the most specialized version of the template function. The general version of the template function, template <class T> void swap(T&, T&), in the algorithm header file works by assignment and is a slow operation. The specialized version in each container is much faster as it can work with the internal representation of the container class.

See also

<hash_map>