operator_bool.pass.cpp 595 B

1234567891011121314151617181920212223242526272829
  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. // explicit operator bool() const
  12. #include <functional>
  13. #include <cassert>
  14. int g(int) {return 0;}
  15. int main()
  16. {
  17. {
  18. std::function<int(int)> f;
  19. assert(!f);
  20. f = g;
  21. assert(f);
  22. }
  23. }