operator_==.pass.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. // <functional>
  10. // class function<R(ArgTypes...)>
  11. // template <MoveConstructible R, MoveConstructible ... ArgTypes>
  12. // bool operator==(const function<R(ArgTypes...)>&, nullptr_t);
  13. //
  14. // template <MoveConstructible R, MoveConstructible ... ArgTypes>
  15. // bool operator==(nullptr_t, const function<R(ArgTypes...)>&);
  16. //
  17. // template <MoveConstructible R, MoveConstructible ... ArgTypes>
  18. // bool operator!=(const function<R(ArgTypes...)>&, nullptr_t);
  19. //
  20. // template <MoveConstructible R, MoveConstructible ... ArgTypes>
  21. // bool operator!=(nullptr_t, const function<R(ArgTypes...)>&);
  22. #include <functional>
  23. #include <cassert>
  24. int g(int) {return 0;}
  25. int main()
  26. {
  27. {
  28. std::function<int(int)> f;
  29. assert(f == nullptr);
  30. assert(nullptr == f);
  31. f = g;
  32. assert(f != nullptr);
  33. assert(nullptr != f);
  34. }
  35. }