Skip to content

Commit

Permalink
use std::invoke() vor C++17 onwards
Browse files Browse the repository at this point in the history
But std::invoke() is defined since C++17.
For pre C++17 use boost::context::detail::invoke() instead.
  • Loading branch information
olk committed Nov 3, 2021
1 parent bf12f18 commit d7e1c1c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/boost/coroutine2/detail/wrap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -43,10 +46,17 @@ class wrapper {

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
}
};

Expand Down

0 comments on commit d7e1c1c

Please sign in to comment.