boost_no_cxx17_std_invoke.ipp 699 B

123456789101112131415161718192021222324252627
  1. // (C) Copyright Oliver Kowalke 2016.
  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_CXX17_STD_INVOKE
  7. // TITLE: invoke
  8. // DESCRIPTION: The compiler supports the std::invoke() function.
  9. #include <functional>
  10. namespace boost_no_cxx17_std_invoke {
  11. int foo( int i, int j) {
  12. return i + j;
  13. }
  14. int test() {
  15. int i = 1, j = 2;
  16. typename std::invoke_result<int(&)(int,int), int, int>::type t = std::invoke( foo, i, j);
  17. return 0;
  18. }
  19. }