auto_handle::swap

Permute les objets avec un autre auto_handle.

void swap(
   auto_handle<_element_type> % _right
);

Paramètres

  • _right
    auto_handle avec lequel pour échanger des objets.

Exemple

// msl_auto_handle_swap.cpp
// compile with: /clr
#include <msclr\auto_handle.h>

using namespace System;
using namespace msclr;

int main() {
   auto_handle<String> s1 = "string one";
   auto_handle<String> s2 = "string two";

   Console::WriteLine( "s1 = '{0}', s2 = '{1}'",
      s1->ToString(), s2->ToString() );
   s1.swap( s2 );
   Console::WriteLine( "s1 = '{0}', s2 = '{1}'",
      s1->ToString(), s2->ToString() );
}
  

Configuration requise

fichier d'en-tête<msclr \ auto_handle.h>

Msclr deEspace de noms

Voir aussi

Référence

fonction d'échange (auto_handle)

Autres ressources

auto_handle Members