Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Visual C++
Header Files
<map>
 swap (multimap)

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Visual C++ Standard Library
swap (multimap)

Exchanges the elements of two multimaps.

template<class _Key, class _Ty, class _Pr, class _Alloc>
void swap(
   multimap<Key, Traits, Compare, Alloctor >& _Left,
   multimap<Key, Traits, Compare, Alloctor >& _Right
);
_Right

The multimap providing the elements to be swapped, or the multimap whose elements are to be exchanged with those of the multimap _Left.

_Left

The multimap whose elements are to be exchanged with those of the multimap _Right.

The template function is an algorithm specialized on the container class map to execute on the container class 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 class 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 the code example for member function multimap::swap for an example that uses the template version of swap.

Header: <map>

Namespace: std

Reference

Other Resources

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker