quick.cpp 457 B

123456789101112131415161718192021
  1. // Copyright 2019 Peter Dimov
  2. // Use, modification and distribution is subject to the Boost Software License, Version 1.0.
  3. // See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
  4. #include <boost/function.hpp>
  5. #include <boost/core/lightweight_test.hpp>
  6. static int f( int x )
  7. {
  8. return x + 1;
  9. }
  10. int main()
  11. {
  12. boost::function<int(int)> fn( f );
  13. BOOST_TEST_EQ( fn( 5 ), 6 );
  14. return boost::report_errors();
  15. }