Sdílet prostřednictvím


operator!= (<memory>)

Testy pro nerovnost mezi objekty.

template<class Type, class Other>
   bool operator!=(
      const allocator<Type>& _Left,
      const allocator<Other>& _Right
   ) throw();
template<class Type1, class Del1, class Type2, class Del2>
    bool operator!=(
        const unique_ptr<Type1, Del1>& _Left,
        const unique_ptr<Type2&, Del2>& _Right
);
template<class Ty1, class Ty2>
    bool operator!=(
        const shared_ptr<Ty1>& _Left,
        const shared_ptr<Ty2>& _Right
   );

Parametry

  • _Left
    Jeden z objektů zkoušení nerovnost.

  • _Right
    Jeden z objektů zkoušení nerovnost.

  • Ty1
    Typ řízena levé sdílené ukazatel.

  • Ty2
    Typ řízeny sdílené ukazatel doprava.

Vrácená hodnota

True v případě, že objekty nejsou shodné; FALSE objekty jsou-li shodné.

Poznámky

První operátor šablony vrátí hodnotu false.(Všechny allocators výchozím nastavení jsou rovné).

Vraťte šablonu druhé a třetí subjekty !(_Left == _Right).

Příklad

// memory_op_me.cpp
// compile with: /EHsc
#include <memory>
#include <iostream>
#include <vector>

using namespace std;

int main( ) 
{
   allocator<double> Alloc;
   vector <char>:: allocator_type v1Alloc;

   if ( Alloc != v1Alloc )
      cout << "The allocator objects Alloc & v1Alloc not are equal."
           << endl;
   else
      cout << "The allocator objects Alloc & v1Alloc are equal."
           << endl;
}
  

 

// std_tr1__memory__operator_ne.cpp 
// compile with: /EHsc 
#include <memory> 
#include <iostream> 
 
int main() 
    { 
    std::shared_ptr<int> sp0(new int(0)); 
    std::shared_ptr<int> sp1(new int(0)); 
 
    std::cout << "sp0 != sp0 == " << std::boolalpha 
        << (sp0 != sp0) << std::endl; 
    std::cout << "sp0 != sp1 == " << std::boolalpha 
        << (sp0 != sp1) << std::endl; 
 
    return (0); 
    } 
 
  

Požadavky

Záhlaví: <memory>

Obor názvů: std

Viz také

Referenční dokumentace

auto_ptr Class

shared_ptr Class

unique_ptr Class

Další zdroje

auto_ptr členů

shared_ptr::Operator! =

unique_ptr členů