다음을 통해 공유


operator!= (<memory>)

개체 간의 서로 다른 지 테스트 합니다.

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
   );

매개 변수

  • _Left
    값이 같지 않은지 테스트 하는 개체 중 하나입니다.

  • _Right
    값이 같지 않은지 테스트 하는 개체 중 하나입니다.

  • Ty1
    왼쪽된 공유 포인터에서 제어 하는 형식입니다.

  • Ty2
    오른쪽 공유 포인터에서 제어 하는 형식입니다.

반환 값

true 이면 개체가; 같지 않은 경우 false 이면 개체가 같으면.

설명

첫 번째 템플릿은 연산자 false를 반환 합니다.(모든 기본 할당자 같습니다.)

템플릿 두 번째와 세 번째 연산자 반환 !(_Left == _Right).

예제

// 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); 
    } 
 
  

요구 사항

헤더: <memory>

네임 스페이스: 국방 표준

참고 항목

참조

auto_ptr Class

shared_ptr Class

unique_ptr Class

기타 리소스

auto_ptr 멤버

shared_ptr::operator! =

unique_ptr 멤버