boost_no_cxx98_binders.ipp 718 B

123456789101112131415161718192021222324252627282930
  1. // (C) Copyright John Maddock 2017.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/config for most recent version.
  6. // MACRO: BOOST_NO_CXX98_BINDERS
  7. // TITLE: std::bind1st, prt_fun and mem_fun
  8. // DESCRIPTION: The std lib has C++98 binders and adaptors.
  9. #include <functional>
  10. namespace boost_no_cxx98_binders{
  11. int f2(int a, int b) { return a + b; }
  12. struct A
  13. {
  14. int f1(int a) { return a; }
  15. };
  16. int test()
  17. {
  18. A a;
  19. return std::bind1st(std::ptr_fun(f2), 0)(0) + std::bind1st(std::mem_fun(&A::f1), &a)(0);
  20. }
  21. }