operator_==.pass.cpp revision bc8d3f97eb5c958007f2713238472e0c1c8fe02c
1//===----------------------------------------------------------------------===// 2// 3// ��������������������The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10// <functional> 11 12// class function<R(ArgTypes...)> 13 14// template <MoveConstructible R, MoveConstructible ... ArgTypes> 15// bool operator==(const function<R(ArgTypes...)>&, nullptr_t); 16// 17// template <MoveConstructible R, MoveConstructible ... ArgTypes> 18// bool operator==(nullptr_t, const function<R(ArgTypes...)>&); 19// 20// template <MoveConstructible R, MoveConstructible ... ArgTypes> 21// bool operator!=(const function<R(ArgTypes...)>&, nullptr_t); 22// 23// template <MoveConstructible R, MoveConstructible ... ArgTypes> 24// bool operator!=(nullptr_t, const function<R(ArgTypes...)>&); 25 26#include <functional> 27#include <cassert> 28 29int g(int) {return 0;} 30 31int main() 32{ 33 { 34 std::function<int(int)> f; 35 assert(f == nullptr); 36 assert(nullptr == f); 37 f = g; 38 assert(f != nullptr); 39 assert(nullptr != f); 40 } 41} 42