This topic has not yet been rated - Rate this topic

swap (<utility>)

Exchanges the elements of two pair Structure objects.

template<class Type1, class Type2>
void swap(pair<Type1, Type2>&_Left,
pair<Type1, Type2>&_Right);

Parameter

Description

_Left

An object of type pair.

_Right

An object of type pair.

One advantage of swap is that the types of objects that are being stored are determined automatically by the compiler and do not have to be explicitly specified. Don't use explicit template arguments such as swap<int, int>(1, 2) when you use swap because it is unnecessarily verbose and adds complex rvalue reference problems that might cause compilation failure.

Header: <utility>

Namespace: std

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.