1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9// UNSUPPORTED: c++03
10
11// <functional>
12
13// class function<R(ArgTypes...)>
14
15// template <MoveConstructible R, MoveConstructible ... ArgTypes>
16// bool operator==(const function<R(ArgTypes...)>&, nullptr_t);
17//
18// template <MoveConstructible R, MoveConstructible ... ArgTypes>
19// bool operator==(nullptr_t, const function<R(ArgTypes...)>&);
20//
21// template <MoveConstructible R, MoveConstructible ... ArgTypes>
22// bool operator!=(const function<R(ArgTypes...)>&, nullptr_t);
23//
24// template <MoveConstructible R, MoveConstructible ... ArgTypes>
25// bool operator!=(nullptr_t, const function<R(ArgTypes...)>&);
26
27#include <functional>
28#include <cassert>
29
30#include "test_macros.h"
31
32int g(int) {return 0;}
33
34int main(int, char**)
35{
36 {
37 std::function<int(int)> f;
38 assert(f == nullptr);
39 assert(nullptr == f);
40 f = g;
41 assert(f != nullptr);
42 assert(nullptr != f);
43 }
44
45 return 0;
46}
47

source code of libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.nullptr/operator_==.pass.cpp