use std::invoke() vor C++17 onwards

But std::invoke() is defined since C++17.
For pre C++17 use boost::context::detail::invoke() instead.
This commit is contained in:
Oliver Kowalke 2021-11-03 17:43:36 +01:00
parent bf12f185c8
commit d7e1c1c4ab

View File

@ -7,10 +7,13 @@
#ifndef BOOST_COROUTINE2_DETAIL_WRAP_H
#define BOOST_COROUTINE2_DETAIL_WRAP_H
#include <functional>
#include <type_traits>
#include <boost/config.hpp>
#if defined(BOOST_NO_CXX17_STD_INVOKE)
#include <boost/context/detail/invoke.hpp>
#endif
#include <boost/context/fiber.hpp>
#include <boost/coroutine2/detail/config.hpp>
@ -43,10 +46,17 @@ public:
boost::context::fiber
operator()( boost::context::fiber && c) {
#if defined(BOOST_NO_CXX17_STD_INVOKE)
return boost::context::detail::invoke(
std::move( fn1_),
fn2_,
std::forward< boost::context::fiber >( c) );
#else
return std::invoke(
std::move( fn1_),
fn2_,
std::forward< boost::context::fiber >( c) );
#endif
}
};