1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. 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 29 int g(int) {return 0;} 30 31 int 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